diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 20:27:10 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:20 -0400 |
commit | 7050c48826d5adb2210bddfb6a67aa13bbe984ed (patch) | |
tree | 21a2f73a9953f1125aea81e02ef547afbe33661a /fs/notify/inotify | |
parent | 6f3a539e3bd8ed2eafa532443723d56896153a00 (diff) | |
download | blackbird-op-linux-7050c48826d5adb2210bddfb6a67aa13bbe984ed.tar.gz blackbird-op-linux-7050c48826d5adb2210bddfb6a67aa13bbe984ed.zip |
inotify: do not reuse watch descriptors
Prior to 2.6.31 inotify would not reuse watch descriptors until all of
them had been used at least once. After the rewrite inotify would reuse
watch descriptors. The selinux utility 'restorecond' was found to have
problems when watch descriptors were reused. This patch reverts to the
pre inotify rewrite behavior to not reuse watch descriptors.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/inotify')
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index a0e40f7c9781..ce21ebaee89e 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -358,7 +358,7 @@ static int inotify_find_inode(const char __user *dirname, struct path *path, uns } static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, - int last_wd, + int *last_wd, struct inotify_inode_mark_entry *ientry) { int ret; @@ -368,11 +368,13 @@ static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, return -ENOMEM; spin_lock(idr_lock); - ret = idr_get_new_above(idr, ientry, last_wd + 1, + ret = idr_get_new_above(idr, ientry, *last_wd + 1, &ientry->wd); /* we added the mark to the idr, take a reference */ - if (!ret) + if (!ret) { fsnotify_get_mark(&ientry->fsn_entry); + *last_wd = ientry->wd; + } spin_unlock(idr_lock); } while (ret == -EAGAIN); @@ -647,7 +649,7 @@ static int inotify_new_watch(struct fsnotify_group *group, if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches) goto out_err; - ret = inotify_add_to_idr(idr, idr_lock, group->inotify_data.last_wd, + ret = inotify_add_to_idr(idr, idr_lock, &group->inotify_data.last_wd, tmp_ientry); if (ret) goto out_err; @@ -660,9 +662,6 @@ static int inotify_new_watch(struct fsnotify_group *group, goto out_err; } - /* update the idr hint, who cares about races, it's just a hint */ - group->inotify_data.last_wd = tmp_ientry->wd; - /* increment the number of watches the user has */ atomic_inc(&group->inotify_data.user->inotify_watches); |