All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] inotify: IN_DELETE events missing in -mm
@ 2006-03-29 15:57 Amy Griffis
  2006-03-29 21:37   ` John McCutchan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Amy Griffis @ 2006-03-29 15:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: John McCutchan, Andrew Morton, Nick Piggin

In recent -mm kernels (e.g. 2.6.16-mm1), IN_DELETE events are no longer 
generated for the removal of a file from a watched directory.

This seems to be a result of clearing DCACHE_INOTIFY_PARENT_WATCHED in
d_delete() directly before calling fsnotify_nameremove().

Assuming the flag doesn't need to be cleared before dentry_iput(), this should
do the trick.

Signed-off-by: Amy Griffis <amy.griffis@hp.com>

diff --git a/fs/dcache.c b/fs/dcache.c
index 363cd4b..344ce91 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1198,11 +1198,11 @@ void d_delete(struct dentry * dentry)
 	spin_lock(&dentry->d_lock);
 	isdir = S_ISDIR(dentry->d_inode->i_mode);
 	if (atomic_read(&dentry->d_count) == 1) {
-		/* remove this and other inotify debug checks after 2.6.18 */
-		dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
-
 		dentry_iput(dentry);
 		fsnotify_nameremove(dentry, isdir);
+
+		/* remove this and other inotify debug checks after 2.6.18 */
+		dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
 		return;
 	}
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] inotify: IN_DELETE events missing in -mm
@ 2006-03-29 21:37   ` John McCutchan
  0 siblings, 0 replies; 4+ messages in thread
From: John McCutchan @ 2006-03-29 21:37 UTC (permalink / raw)
  To: Amy Griffis; +Cc: linux-kernel, John McCutchan, Andrew Morton, Nick Piggin

On Wed, 2006-29-03 at 10:57 -0500, Amy Griffis wrote:
> In recent -mm kernels (e.g. 2.6.16-mm1), IN_DELETE events are no longer 
> generated for the removal of a file from a watched directory.
> 
> This seems to be a result of clearing DCACHE_INOTIFY_PARENT_WATCHED in
> d_delete() directly before calling fsnotify_nameremove().
> 
> Assuming the flag doesn't need to be cleared before dentry_iput(), this should
> do the trick.

I took a quick look at nick's patch again, and it doesn't seem to
require the flag being cleared before dentry_iput. This looks good to
me. Nick?

-- 
John McCutchan <john@johnmccutchan.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] inotify: IN_DELETE events missing in -mm
  2006-03-29 15:57 [PATCH] inotify: IN_DELETE events missing in -mm Amy Griffis
  2006-03-29 21:37   ` John McCutchan
@ 2006-03-30  1:51 ` Nick Piggin
  2013-10-16 20:38 ` Jim Mostek
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2006-03-30  1:51 UTC (permalink / raw)
  To: Amy Griffis; +Cc: linux-kernel, John McCutchan, Andrew Morton, Greg KH

Amy Griffis wrote:

>In recent -mm kernels (e.g. 2.6.16-mm1), IN_DELETE events are no longer 
>generated for the removal of a file from a watched directory.
>
>This seems to be a result of clearing DCACHE_INOTIFY_PARENT_WATCHED in
>d_delete() directly before calling fsnotify_nameremove().
>
>Assuming the flag doesn't need to be cleared before dentry_iput(), this should
>do the trick.
>
>

Thanks Amy. This should go to the next -stable kernel too.

>Signed-off-by: Amy Griffis <amy.griffis@hp.com>
>
>diff --git a/fs/dcache.c b/fs/dcache.c
>index 363cd4b..344ce91 100644
>--- a/fs/dcache.c
>+++ b/fs/dcache.c
>@@ -1198,11 +1198,11 @@ void d_delete(struct dentry * dentry)
> 	spin_lock(&dentry->d_lock);
> 	isdir = S_ISDIR(dentry->d_inode->i_mode);
> 	if (atomic_read(&dentry->d_count) == 1) {
>-		/* remove this and other inotify debug checks after 2.6.18 */
>-		dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
>-
> 		dentry_iput(dentry);
> 		fsnotify_nameremove(dentry, isdir);
>+
>+		/* remove this and other inotify debug checks after 2.6.18 */
>+		dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
> 		return;
> 	}
>

Send instant messages to your online friends http://au.messenger.yahoo.com 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] inotify: IN_DELETE events missing in -mm
  2006-03-29 15:57 [PATCH] inotify: IN_DELETE events missing in -mm Amy Griffis
  2006-03-29 21:37   ` John McCutchan
  2006-03-30  1:51 ` Nick Piggin
@ 2013-10-16 20:38 ` Jim Mostek
  2 siblings, 0 replies; 4+ messages in thread
From: Jim Mostek @ 2013-10-16 20:38 UTC (permalink / raw)
  To: linux-kernel


You cannot move this line of code after dentry_iput(dentry); without
considerations for locking.

Another thread can get this dentry and be changing dentry->d_flags at the
same time!
We have hit this in testing. The code must be changed to have locks (if this
field needs to be changed or ...)

In our tests, the flag 0x10 in __d_drop goes missing because this line of
code executed at the same time on another processor.



--
View this message in context: http://linux-kernel.2935.n7.nabble.com/PATCH-inotify-IN-DELETE-events-missing-in-mm-tp105372p738511.html
Sent from the Linux Kernel mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-16 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-29 15:57 [PATCH] inotify: IN_DELETE events missing in -mm Amy Griffis
2006-03-29 21:37 ` John McCutchan
2006-03-29 21:37   ` John McCutchan
2006-03-30  1:51 ` Nick Piggin
2013-10-16 20:38 ` Jim Mostek

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.