All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kouya Shimura <kouya@jp.fujitsu.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] tools/hotplug/Linux: forced to release lock if holder process is gone
Date: Wed, 15 Dec 2010 13:26:56 +0900	[thread overview]
Message-ID: <7k7hfbwti5.fsf@jp.fujitsu.com> (raw)
In-Reply-To: <19719.42613.402719.207790@mariner.uk.xensource.com>

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 802 bytes --]

Sorry, the patch was unsafe for mutual exclusion. Please apply this too.
Since there is a case that the owner file doesn't exist yet
when an atomic mkdir operation fails.

Thanks,
Kouya

Ian Jackson writes:
> Kouya Shimura writes ("[Xen-devel] [PATCH] tools/hotplug/Linux: forced to release lock if holder process is gone"):
> > When a script using locking.sh is stopped by ctrl-C, the lock file remains.
> > We have to wait 100 seconds for releasing the lock at the next time.
> 
> Thanks, I have applied your patch.
> 
> This kind of thing is one reason why lockfiles where the lock is
> regarded as held if the file exists are horrible.  It's a shame that
> we don't have any fcntl/flock style locking primitives available in
> shell.
> 
> Ian.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>


[-- Attachment #2: locking.sh2.patch --]
[-- Type: text/x-patch, Size: 463 bytes --]

diff -r 197c0b40423a tools/hotplug/Linux/locking.sh
--- a/tools/hotplug/Linux/locking.sh	Tue Dec 14 19:28:25 2010 +0000
+++ b/tools/hotplug/Linux/locking.sh	Wed Dec 15 11:56:04 2010 +0900
@@ -63,7 +63,7 @@ _claim_lock()
       retries=0
     else
       local pid=$(echo $owner | cut -d : -f 1)
-      if [ ! -f "/proc/$pid/status" ]
+      if [ -n "$pid" -a "$pid" != "unknown" -a ! -f "/proc/$pid/status" ]
       then
         _release_lock $lockdir
       fi

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2010-12-15  4:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14  8:38 [PATCH] tools/hotplug/Linux: forced to release lock if holder process is gone Kouya Shimura
2010-12-14 17:16 ` Ian Jackson
2010-12-15  4:26   ` Kouya Shimura [this message]
2010-12-15 16:49     ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7k7hfbwti5.fsf@jp.fujitsu.com \
    --to=kouya@jp.fujitsu.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.