Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28018
b: refs/heads/master
c: 3ca1006
h: refs/heads/master
v: v3
  • Loading branch information
Amy Griffis authored and Al Viro committed Jun 20, 2006
1 parent c17bed9 commit 9a34543
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 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: a9dc971d3fdb857a2bcd6d53238125a2cd31d5f4
refs/heads/master: 3ca10067f7f4bfa62a1b0edc84f590261fa02d75
23 changes: 14 additions & 9 deletions trunk/fs/inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static struct inotify_watch *inode_find_handle(struct inode *inode,
}

/*
* remove_watch_no_event - remove_watch() without the IN_IGNORED event.
* remove_watch_no_event - remove watch without the IN_IGNORED event.
*
* Callers must hold both inode->inotify_mutex and ih->mutex.
*/
Expand All @@ -223,17 +223,22 @@ static void remove_watch_no_event(struct inotify_watch *watch,
idr_remove(&ih->idr, watch->wd);
}

/*
* remove_watch - Remove a watch from both the handle and the inode. Sends
* the IN_IGNORED event signifying that the inode is no longer watched.
/**
* inotify_remove_watch_locked - Remove a watch from both the handle and the
* inode. Sends the IN_IGNORED event signifying that the inode is no longer
* watched. May be invoked from a caller's event handler.
* @ih: inotify handle associated with watch
* @watch: watch to remove
*
* Callers must hold both inode->inotify_mutex and ih->mutex.
*/
static void remove_watch(struct inotify_watch *watch, struct inotify_handle *ih)
void inotify_remove_watch_locked(struct inotify_handle *ih,
struct inotify_watch *watch)
{
remove_watch_no_event(watch, ih);
ih->in_ops->handle_event(watch, watch->wd, IN_IGNORED, 0, NULL, NULL);
}
EXPORT_SYMBOL_GPL(inotify_remove_watch_locked);

/* Kernel API for producing events */

Expand Down Expand Up @@ -378,7 +383,7 @@ void inotify_unmount_inodes(struct list_head *list)

need_iput_tmp = need_iput;
need_iput = NULL;
/* In case the remove_watch() drops a reference. */
/* In case inotify_remove_watch_locked() drops a reference. */
if (inode != need_iput_tmp)
__iget(inode);
else
Expand Down Expand Up @@ -411,7 +416,7 @@ void inotify_unmount_inodes(struct list_head *list)
mutex_lock(&ih->mutex);
ih->in_ops->handle_event(watch, watch->wd, IN_UNMOUNT, 0,
NULL, NULL);
remove_watch(watch, ih);
inotify_remove_watch_locked(ih, watch);
mutex_unlock(&ih->mutex);
}
mutex_unlock(&inode->inotify_mutex);
Expand All @@ -434,7 +439,7 @@ void inotify_inode_is_dead(struct inode *inode)
list_for_each_entry_safe(watch, next, &inode->inotify_watches, i_list) {
struct inotify_handle *ih = watch->ih;
mutex_lock(&ih->mutex);
remove_watch(watch, ih);
inotify_remove_watch_locked(ih, watch);
mutex_unlock(&ih->mutex);
}
mutex_unlock(&inode->inotify_mutex);
Expand Down Expand Up @@ -687,7 +692,7 @@ int inotify_rm_wd(struct inotify_handle *ih, u32 wd)

/* make sure that we did not race */
if (likely(idr_find(&ih->idr, wd) == watch))
remove_watch(watch, ih);
inotify_remove_watch_locked(ih, watch);

mutex_unlock(&ih->mutex);
mutex_unlock(&inode->inotify_mutex);
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/inotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
struct inode *, __u32);
extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
extern int inotify_rm_wd(struct inotify_handle *, __u32);
extern void inotify_remove_watch_locked(struct inotify_handle *,
struct inotify_watch *);
extern void get_inotify_watch(struct inotify_watch *);
extern void put_inotify_watch(struct inotify_watch *);

Expand Down Expand Up @@ -205,6 +207,11 @@ static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
return -EOPNOTSUPP;
}

static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
struct inotify_watch *watch)
{
}

static inline void get_inotify_watch(struct inotify_watch *watch)
{
}
Expand Down

0 comments on commit 9a34543

Please sign in to comment.