diff options
Diffstat (limited to 'fs/notify')
-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 | |||
358 | } | 358 | } |
359 | 359 | ||
360 | static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, | 360 | static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, |
361 | int last_wd, | 361 | int *last_wd, |
362 | struct inotify_inode_mark_entry *ientry) | 362 | struct inotify_inode_mark_entry *ientry) |
363 | { | 363 | { |
364 | int ret; | 364 | int ret; |
@@ -368,11 +368,13 @@ static int inotify_add_to_idr(struct idr *idr, spinlock_t *idr_lock, | |||
368 | return -ENOMEM; | 368 | return -ENOMEM; |
369 | 369 | ||
370 | spin_lock(idr_lock); | 370 | spin_lock(idr_lock); |
371 | ret = idr_get_new_above(idr, ientry, last_wd + 1, | 371 | ret = idr_get_new_above(idr, ientry, *last_wd + 1, |
372 | &ientry->wd); | 372 | &ientry->wd); |
373 | /* we added the mark to the idr, take a reference */ | 373 | /* we added the mark to the idr, take a reference */ |
374 | if (!ret) | 374 | if (!ret) { |
375 | fsnotify_get_mark(&ientry->fsn_entry); | 375 | fsnotify_get_mark(&ientry->fsn_entry); |
376 | *last_wd = ientry->wd; | ||
377 | } | ||
376 | spin_unlock(idr_lock); | 378 | spin_unlock(idr_lock); |
377 | } while (ret == -EAGAIN); | 379 | } while (ret == -EAGAIN); |
378 | 380 | ||
@@ -647,7 +649,7 @@ static int inotify_new_watch(struct fsnotify_group *group, | |||
647 | if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches) | 649 | if (atomic_read(&group->inotify_data.user->inotify_watches) >= inotify_max_user_watches) |
648 | goto out_err; | 650 | goto out_err; |
649 | 651 | ||
650 | ret = inotify_add_to_idr(idr, idr_lock, group->inotify_data.last_wd, | 652 | ret = inotify_add_to_idr(idr, idr_lock, &group->inotify_data.last_wd, |
651 | tmp_ientry); | 653 | tmp_ientry); |
652 | if (ret) | 654 | if (ret) |
653 | goto out_err; | 655 | goto out_err; |
@@ -660,9 +662,6 @@ static int inotify_new_watch(struct fsnotify_group *group, | |||
660 | goto out_err; | 662 | goto out_err; |
661 | } | 663 | } |
662 | 664 | ||
663 | /* update the idr hint, who cares about races, it's just a hint */ | ||
664 | group->inotify_data.last_wd = tmp_ientry->wd; | ||
665 | |||
666 | /* increment the number of watches the user has */ | 665 | /* increment the number of watches the user has */ |
667 | atomic_inc(&group->inotify_data.user->inotify_watches); | 666 | atomic_inc(&group->inotify_data.user->inotify_watches); |
668 | 667 | ||