From 3eb9eb7db4706226f11bc8ffba6985ac570e44cc Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 24 May 2012 16:52:51 +0000 Subject: [PATCH] hasn- fix shared_root locking git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12922 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index f01eae1c5..aab81ffb1 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -10224,9 +10224,10 @@ sub mkdsklsnode # try to get a lock if this is shared_root and using # a shared filesystem if ($origloc && ($sharedinstall eq "sns")) { - - $lockfile = "$origloc/lockfile"; - open($SRlock, "<", $lockfile); + my $fl = dirname($origloc); + $lockfile = "$fl/lockfile_$imagehash{$image_name}{shared_root}"; + # ex. /install/nim/shared_root/lockfile_71Dskls + open($SRlock, ">>", $lockfile); flock($SRlock,LOCK_EX); $locked++; } @@ -10249,6 +10250,10 @@ sub mkdsklsnode xCAT::MsgUtils->message("E", $rsp, $callback); $error++; push(@nodesfailed, $node); + if ($locked) { + flock($SRlock,LOCK_UN); + close($SRlock); + } next; } @@ -11784,8 +11789,10 @@ sub make_SN_resource # need to set a lock so that some other SN doesn't # modify anything while we're doing this # - $lockfile = "$origloc/lockfile"; - open($SRlock, "<", $lockfile); + my $fl = dirname($origloc); + $lockfile = "$fl/lockfile_$imghash{$image}{$restype}"; + # ex. /install/nim/shared_root/lockfile_71Dskls + open($SRlock, ">>", $lockfile); flock($SRlock,LOCK_EX); $locked++; @@ -11841,8 +11848,8 @@ sub make_SN_resource } if ( $locked) { - flock($lockfile,LOCK_UN); - close($lockfile); + flock($SRlock,LOCK_UN); + close($SRlock); } } # only make lpp_source for standalone type images