SOURCES: linux-2.6.22-inotify-fix.patch (NEW) - fix (from /var/log/kernel):...

charles charles at pld-linux.org
Tue Jun 24 14:36:53 CEST 2008


Author: charles                      Date: Tue Jun 24 12:36:53 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix (from /var/log/kernel):
kernel: WARNING: at fs/inotify.c:172 set_dentry_child_flags()
kernel: [<c01b04ff>] set_dentry_child_flags+0xcf/0x160
kernel: [<c01b0c51>] inotify_add_watch+0x101/0x110
kernel: [<c01b1773>] sys_inotify_add_watch+0x153/0x180
kernel: [<c01b0995>] put_inotify_watch+0x35/0x60
kernel: [<c01b0a41>] inotify_rm_wd+0x81/0xb0
kernel: [<c0104232>] sysenter_past_esp+0x6b/0xa1
kernel: =======================

---- Files affected:
SOURCES:
   linux-2.6.22-inotify-fix.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linux-2.6.22-inotify-fix.patch
diff -u /dev/null SOURCES/linux-2.6.22-inotify-fix.patch:1.1
--- /dev/null	Tue Jun 24 14:36:54 2008
+++ SOURCES/linux-2.6.22-inotify-fix.patch	Tue Jun 24 14:36:48 2008
@@ -0,0 +1,77 @@
+--- linux-2.6.22/fs/dcache.c.orig	2007-07-09 01:32:17.000000000 +0200
++++ linux-2.6.22/fs/dcache.c	2008-06-24 12:00:23.000000000 +0200
+@@ -1407,9 +1407,6 @@
+ 	if (atomic_read(&dentry->d_count) == 1) {
+ 		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;
+ 	}
+ 
+--- linux-2.6.22/fs/inotify.c.orig	2007-07-09 01:32:17.000000000 +0200
++++ linux-2.6.22/fs/inotify.c	2008-06-24 12:17:40.000000000 +0200
+@@ -168,20 +168,14 @@
+ 		struct dentry *child;
+ 
+ 		list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) {
+-			if (!child->d_inode) {
+-				WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
++			if (!child->d_inode)
+ 				continue;
+-			}
++
+ 			spin_lock(&child->d_lock);
+-			if (watched) {
+-				WARN_ON(child->d_flags &
+-						DCACHE_INOTIFY_PARENT_WATCHED);
++			if (watched)
+ 				child->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
+-			} else {
+-				WARN_ON(!(child->d_flags &
+-					DCACHE_INOTIFY_PARENT_WATCHED));
++			else
+ 				child->d_flags&=~DCACHE_INOTIFY_PARENT_WATCHED;
+-			}
+ 			spin_unlock(&child->d_lock);
+ 		}
+ 	}
+@@ -253,7 +247,6 @@
+ 	if (!inode)
+ 		return;
+ 
+-	WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
+ 	spin_lock(&entry->d_lock);
+ 	parent = entry->d_parent;
+ 	if (parent->d_inode && inotify_inode_watched(parent->d_inode))
+@@ -627,6 +620,7 @@
+ 		      struct inode *inode, u32 mask)
+ {
+ 	int ret = 0;
++	int newly_watched;
+ 
+ 	/* don't allow invalid bits: we don't want flags set */
+ 	mask &= IN_ALL_EVENTS | IN_ONESHOT;
+@@ -653,12 +647,18 @@
+ 	 */
+ 	watch->inode = igrab(inode);
+ 
+-	if (!inotify_inode_watched(inode))
+-		set_dentry_child_flags(inode, 1);
+-
+ 	/* Add the watch to the handle's and the inode's list */
++	newly_watched = !inotify_inode_watched(inode);
+ 	list_add(&watch->h_list, &ih->watches);
+ 	list_add(&watch->i_list, &inode->inotify_watches);
++       /*
++        * Set child flags _after_ adding the watch, so there is no race
++        * windows where newly instantiated children could miss their parent's
++        * watched flag.
++        */
++       if (newly_watched)
++               set_dentry_child_flags(inode, 1);
++
+ out:
+ 	mutex_unlock(&ih->mutex);
+ 	mutex_unlock(&inode->inotify_mutex);
================================================================


More information about the pld-cvs-commit mailing list