mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Love <rml@novell.com>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: John McCutchan <ttb@tentacle.dhs.org>,
	linux-kernel@vger.kernel.org, Mr Morton <akpm@osdl.org>
Subject: Re: [patch] updated inotify for 2.6.12-rc3.
Date: Fri, 22 Apr 2005 19:27:18 -0400	[thread overview]
Message-ID: <1114212438.6975.3.camel@jenny.boston.ximian.com> (raw)
In-Reply-To: <20050422211324.GF13052@parcelfarce.linux.theplanet.co.uk>

On Fri, 2005-04-22 at 22:13 +0100, Al Viro wrote:

> Or it would, if remove_watch() had been called only once.  In the scenario
> above that will not be true.

Thanks.

	Robert Love


Double check that we don't race.

Signed-off-by: Robert Love <rml@novell.com>

 fs/inotify.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -urN linux-2.6.12-rc3-inotify/fs/inotify.c linux/fs/inotify.c
--- linux-2.6.12-rc3-inotify/fs/inotify.c	2005-04-22 19:20:14.000000000 -0400
+++ linux/fs/inotify.c	2005-04-22 19:25:44.000000000 -0400
@@ -861,12 +861,17 @@
 		return -EINVAL;
 	}
 	get_inotify_watch(watch);
+	inode = watch->inode;	
 	up(&dev->sem);
 
-	inode = watch->inode;
 	down(&inode->inotify_sem);
 	down(&dev->sem);
-	remove_watch(watch, dev);
+
+	/* make sure we did not race */
+	watch = idr_find(&dev->idr, wd);
+	if (likely(watch))
+		remove_watch(watch, dev);
+
 	up(&dev->sem);
 	up(&inode->inotify_sem);
 	put_inotify_watch(watch);



  reply	other threads:[~2005-04-22 23:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21  5:13 [patch] " Robert Love
2005-04-21  5:31 ` Robert Love
2005-04-21 23:47 ` [patch] oneshot for inotify Robert Love
2005-04-22  4:57 ` [patch] inotify for 2.6.12-rc3 Robert Love
2005-04-22  5:01 ` [patch] updated " Robert Love
2005-04-22  8:56   ` Al Viro
2005-04-22 15:04     ` John McCutchan
2005-04-22 21:13       ` Al Viro
2005-04-22 23:27         ` Robert Love [this message]
2005-04-28 20:38   ` [patch] latest inotify Robert Love

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=1114212438.6975.3.camel@jenny.boston.ximian.com \
    --to=rml@novell.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttb@tentacle.dhs.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®