[GIT PULL] notification tree changes for 3.8

From: Eric Paris
Date: Thu Dec 20 2012 - 17:38:54 EST


I believe you would get a build failure after this pull due to the
addition of procfs information for *notify fds. The attached patch from
sfr should be applied during the merge to change the spin_lock in that
patch to the mutex in this patch.

This pull mostly is about locking changes in the fsnotify system. By
switching the group lock from a spin_lock() to a mutex() we can now hold
the lock across things like iput(). This fixes a problem involving
unmounting a fs and having inodes be busy, first pointed out by FAT, but
reproducible with tmpfs.

This also restores signal driven I/O for inotify, which has been broken
since about 2.6.32.

$ git request-pull v3.6 git://git.infradead.org/users/eparis/notify.git
The following changes since commit a0d271cbfed1dd50278c6b06bead3d00ba0a88f9:

Linux 3.6 (2012-09-30 16:47:46 -0700)

are available in the git repository at:

git://git.infradead.org/users/eparis/notify.git for-next

for you to fetch changes up to 1ca39ab9d21ac93f94b9e3eb364ea9a5cf2aba06:

inotify: automatically restart syscalls (2012-12-11 13:44:37 -0500)

----------------------------------------------------------------
Eric Paris (2):
fsnotify: make fasync generic for both inotify and fanotify
inotify: automatically restart syscalls

Lino Sanfilippo (12):
inotify, fanotify: replace fsnotify_put_group() with fsnotify_destroy_group()
fsnotify: introduce fsnotify_get_group()
fsnotify: use reference counting for groups
fsnotify: take groups mark_lock before mark lock
fanotify: add an extra flag to mark_remove_from_mask that indicates wheather a mark should be destroyed
fsnotify: use a mutex instead of a spinlock to protect a groups mark list
fsnotify: pass group to fsnotify_destroy_mark()
fsnotify: introduce locked versions of fsnotify_add_mark() and fsnotify_remove_mark()
fsnotify: dont put marks on temporary list when clearing marks by group
fsnotify: change locking order
fanotify: dont merge permission events
inotify: dont skip removal of watch descriptor if creation of ignored event failed

fs/notify/dnotify/dnotify.c | 4 ++--
fs/notify/fanotify/fanotify.c | 6 ++++++
fs/notify/fanotify/fanotify_user.c | 37 +++++++++++++++++++++++++------------
fs/notify/group.c | 47 +++++++++++++++++++++++++++--------------------
fs/notify/inode_mark.c | 14 +++++++++++---
fs/notify/inotify/inotify_fsnotify.c | 4 +++-
fs/notify/inotify/inotify_user.c | 34 ++++++++++++++--------------------
fs/notify/mark.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------
fs/notify/notification.c | 1 +
fs/notify/vfsmount_mark.c | 14 +++++++++++---
include/linux/fsnotify_backend.h | 31 +++++++++++++++++++++----------
kernel/audit_tree.c | 10 +++++-----
kernel/audit_watch.c | 4 ++--
13 files changed, 178 insertions(+), 119 deletions(-)
From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2012 11:53:20 +1100
Subject: [PATCH] fsnotify: cope with change from spinlock to mutex

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
fs/notify/fdinfo.c |ÂÂÂ 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c
index 514c4b8..238a593 100644
--- a/fs/notify/fdinfo.c
+++ b/fs/notify/fdinfo.c
@@ -27,13 +27,13 @@ static int show_fdinfo(struct seq_file *m, struct file *f,
struct fsnotify_mark *mark;
int ret = 0;

- spin_lock(&group->mark_lock);
+ mutex_lock(&group->mark_mutex);
list_for_each_entry(mark, &group->marks_list, g_list) {
ret = show(m, mark);
if (ret)
break;
}
- spin_unlock(&group->mark_lock);
+ mutex_unlock(&group->mark_mutex);
return ret;
}