Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347903
b: refs/heads/master
c: 6960b0d
h: refs/heads/master
i:
  347901: d79e0f4
  347899: 72636de
  347895: f3783af
  347887: 7e1a772
  347871: fd68a11
  347839: 829ff6e
  347775: 1992ce1
  347647: 599f33f
v: v3
  • Loading branch information
Lino Sanfilippo authored and Eric Paris committed Dec 11, 2012
1 parent 86a0f69 commit a86bb67
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 64c20d2a20fce295c260ea6cb3b468edfa2fb07b
refs/heads/master: 6960b0d909cde5bdff49e4e5c1250edd10be7ebd
20 changes: 10 additions & 10 deletions trunk/fs/notify/mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,20 @@ void fsnotify_destroy_mark_locked(struct fsnotify_mark *mark,

spin_unlock(&mark->lock);

if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED))
iput(inode);
/* release lock temporarily */
mutex_unlock(&group->mark_mutex);

spin_lock(&destroy_lock);
list_add(&mark->destroy_list, &destroy_list);
spin_unlock(&destroy_lock);
wake_up(&destroy_waitq);
/*
* We don't necessarily have a ref on mark from caller so the above destroy
* may have actually freed it, unless this group provides a 'freeing_mark'
* function which must be holding a reference.
*/

/*
* Some groups like to know that marks are being freed. This is a
Expand All @@ -178,22 +185,15 @@ void fsnotify_destroy_mark_locked(struct fsnotify_mark *mark,
* is just a lazy update (and could be a perf win...)
*/

if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED))
iput(inode);
/*
* We don't necessarily have a ref on mark from caller so the above iput
* may have already destroyed it. Don't touch from now on.
*/

atomic_dec(&group->num_marks);

mutex_lock(&group->mark_mutex);
mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
}

void fsnotify_destroy_mark(struct fsnotify_mark *mark,
struct fsnotify_group *group)
{
mutex_lock(&group->mark_mutex);
mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
fsnotify_destroy_mark_locked(mark, group);
mutex_unlock(&group->mark_mutex);
}
Expand Down Expand Up @@ -300,7 +300,7 @@ void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group,
{
struct fsnotify_mark *lmark, *mark;

mutex_lock(&group->mark_mutex);
mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
if (mark->flags & flags) {
fsnotify_get_mark(mark);
Expand Down
7 changes: 4 additions & 3 deletions trunk/include/linux/fsnotify_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ struct fsnotify_event_private_data;
* if the group is interested in this event.
* handle_event - main call for a group to handle an fs event
* free_group_priv - called when a group refcnt hits 0 to clean up the private union
* freeing-mark - this means that a mark has been flagged to die when everything
* finishes using it. The function is supplied with what must be a
* valid group and inode to use to clean up.
* freeing_mark - called when a mark is being destroyed for some reason. The group
* MUST be holding a reference on each mark and that reference must be
* dropped in this function. inotify uses this function to send
* userspace messages that marks have been removed.
*/
struct fsnotify_ops {
bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
Expand Down

0 comments on commit a86bb67

Please sign in to comment.