fsnotify: misc cleanups
Subsystems (12)
Amir Goldstein
reviewercover fsnotify: misc cleanups
Al,
This 4 patch series is a prelude to my work on fanotify super block watch, which is available on my github:
https://github.com/amir73il/linux/commits/fanotify_sb
I will argue for super block watch and post the patches another time after I get more testing.
In the mean while, would you please consider these cleanup patches. IMO, they make the code cleaner and more readable and they should have no effect (functional and performance wise) on existing backends.
Amir Goldstein (4):
fsnotify: pass dentry instead of inode when available
fsnotify: annotate filename events
fsnotify: simplify API for filename events
fsnotify: make MOVED_FROM a dentry event
arch/powerpc/platforms/cell/spufs/inode.c | 2 +- fs/btrfs/ioctl.c | 2 +- fs/debugfs/inode.c | 8 ++-- fs/devpts/inode.c | 2 +- fs/namei.c | 23 +++++---- fs/notify/fsnotify.c | 2 +- fs/ocfs2/refcounttree.c | 2 +- fs/tracefs/inode.c | 4 +- include/linux/fsnotify.h | 78 +++++++++++++++++++++---------- include/linux/fsnotify_backend.h | 3 +- net/sunrpc/rpc_pipe.c | 6 +-- 11 files changed, 82 insertions(+), 50 deletions(-)
Signature · 1 line
2.7.4
Amir Goldstein
reviewerPATCH 1/4 fsnotify: pass dentry instead of inode when available
Define a new data type to pass for event FSNOTIFY_EVENT_DENTRY and use it whenever a dentry is available instead of passing it's ->d_inode as data type FSNOTIFY_EVENT_INODE.
None of the current fsnotify backends make use of the inode data with data type FSNOTIFY_EVENT_INODE - only the data of type FSNOTIFY_EVENT_PATH is ever used, so this change has no immediate consequences.
Soon, we are going to use the dentry data type to support more events with fanotify backend.
--- fs/notify/fsnotify.c | 2 +- include/linux/fsnotify.h | 15 +++++++-------- include/linux/fsnotify_backend.h | 3 ++- 3 files changed, 10 insertions(+), 10 deletions(-)
fs/notify/fsnotify.c +1 -1
@@ -112,7 +112,7 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask ret =fsnotify (p_inode, mask, path,FSNOTIFY_EVENT_PATH , dentry->d_name.name,0 ); else - ret =fsnotify (p_inode, mask, dentry->d_inode,FSNOTIFY_EVENT_INODE , + ret =fsnotify (p_inode, mask, dentry,FSNOTIFY_EVENT_DENTRY , dentry->d_name.name,0 ); }
include/linux/fsnotify.h +7 -8
@@ -86,14 +86,14 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,fsnotify (old_dir, old_dir_mask, source,FSNOTIFY_EVENT_INODE , old_name, fs_cookie); -fsnotify (new_dir, new_dir_mask, source,FSNOTIFY_EVENT_INODE , new_name, +fsnotify (new_dir, new_dir_mask, moved,FSNOTIFY_EVENT_DENTRY , new_name, fs_cookie);if (target)fsnotify_link_count (target);if (source) -fsnotify (source,FS_MOVE_SELF , moved->d_inode,FSNOTIFY_EVENT_INODE ,NULL ,0 ); +fsnotify (source,FS_MOVE_SELF , moved,FSNOTIFY_EVENT_DENTRY ,NULL ,0 );audit_inode_child (new_dir, moved,AUDIT_TYPE_CHILD_CREATE ); }
@@ -142,7 +142,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) {audit_inode_child (inode, dentry,AUDIT_TYPE_CHILD_CREATE ); -fsnotify (inode,FS_CREATE , dentry->d_inode,FSNOTIFY_EVENT_INODE , dentry->d_name.name,0 ); +fsnotify (inode,FS_CREATE , dentry,FSNOTIFY_EVENT_DENTRY , dentry->d_name.name,0 ); }/*
@@ -155,7 +155,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, structfsnotify_link_count (inode);audit_inode_child (dir, new_dentry,AUDIT_TYPE_CHILD_CREATE ); -fsnotify (dir,FS_CREATE , inode,FSNOTIFY_EVENT_INODE , new_dentry->d_name.name,0 ); +fsnotify (dir,FS_CREATE , new_dentry,FSNOTIFY_EVENT_DENTRY , new_dentry->d_name.name,0 ); }/*
@@ -164,11 +164,10 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, structstatic inline void fsnotify_mkdir (struct inode *inode,struct dentry *dentry) {__u32 mask = (FS_CREATE |FS_ISDIR ); -struct inode *d_inode = dentry->d_inode;audit_inode_child (inode, dentry,AUDIT_TYPE_CHILD_CREATE ); -fsnotify (inode, mask, d_inode,FSNOTIFY_EVENT_INODE , dentry->d_name.name,0 ); +fsnotify (inode, mask, dentry,FSNOTIFY_EVENT_DENTRY , dentry->d_name.name,0 ); }/*
@@ -254,7 +253,7 @@ static inline void fsnotify_xattr(struct dentry *dentry) mask |=FS_ISDIR ;fsnotify_parent (NULL , dentry, mask); -fsnotify (inode, mask, inode,FSNOTIFY_EVENT_INODE ,NULL ,0 ); +fsnotify (inode, mask, dentry,FSNOTIFY_EVENT_DENTRY ,NULL ,0 ); }/*
@@ -289,7 +288,7 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) mask |=FS_ISDIR ;fsnotify_parent (NULL , dentry, mask); -fsnotify (inode, mask, inode,FSNOTIFY_EVENT_INODE ,NULL ,0 ); +fsnotify (inode, mask, dentry,FSNOTIFY_EVENT_DENTRY ,NULL ,0 ); } }
include/linux/fsnotify_backend.h +2 -1
@@ -188,10 +188,11 @@ struct fsnotify_group { }; }; -/* when calling fsnotify tell it if the data is a path or inode */ +/* when calling fsnotify tell it if the data is a path or inode or dentry */ #define FSNOTIFY_EVENT_NONE 0#define FSNOTIFY_EVENT_PATH 1#define FSNOTIFY_EVENT_INODE 2 +#define FSNOTIFY_EVENT_DENTRY 3/* * A mark is simply an object attached to an in core inode which allows an
Signature · 1 line
2.7.4
Amir Goldstein
reviewerPATCH 2/4 fsnotify: annotate filename events
In reply to Amir GoldsteinFilename events are referring to events that modify directory entries, such as create,delete,rename. Those events should always be reported on a watched directory, regardless if FS_EVENT_ON_CHILD is set on the watch mask.
fsnotify_nameremove() and fsnotify_move() were modified to no longer set the FS_EVENT_ON_CHILD event bit. This is a semantic change to align with the filename event definition. It has no effect on any existing backend, because dnotify and inotify always requets the child events and fanotify does not get the delete,rename events.
The fsnotify_filename() helper is used to report all the filename events. It gets a reference on parent dentry and passes it as the data for the event along with the filename.
fsnotify_filename() is different from fsnotify_parent(). fsnotify_parent() is intended to report any events that happened on child inodes when FS_EVENT_ON_CHILD is requested. fsnotify_filename() is intended to report only filename events, such as create,mkdir,link. Those events must always be reported on a watched directory, regardless if FS_EVENT_ON_CHILD was requested.
fsnotify_d_name() is a helper for the common case where the filename to pass is dentry->d_name.name.
It is safe to use these helpers with negative or not instantiated dentries, such as the case with fsnotify_link() and fsnotify_nameremove().
--- include/linux/fsnotify.h | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
include/linux/fsnotify.h +29 -8
@@ -25,6 +25,28 @@ static inline int fsnotify_parent(const struct path *path, struct dentry *dentryreturn __fsnotify_parent (path, dentry, mask); } +/* +* Notify this parent about a filename event (create,delete,rename). +* Unlike fsnotify_parent(), the event will be reported regardless of the +* FS_EVENT_ON_CHILD mask on the parent inode +*/ +static inline int fsnotify_filename (struct dentry *parent,__u32 mask, +const unsigned char *file_name,u32 cookie) +{ +return fsnotify (d_inode (parent), mask, parent,FSNOTIFY_EVENT_DENTRY , + file_name, cookie); +} + +/* +* Call fsnotify_filename() with parent and d_name of this dentry. +* Safe to call with negative dentry, e.g. from fsnotify_nameremove() +*/ +static inline int fsnotify_d_name (struct dentry *dentry,__u32 mask) +{ +return fsnotify_filename (dentry->d_parent, mask, + dentry->d_name.name,0 ); +} +/* simple call site for access decisions */ static inline int fsnotify_perm (struct file *file,int mask) {
@@ -72,8 +94,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, {struct inode *source = moved->d_inode;u32 fs_cookie =fsnotify_get_cookie (); -__u32 old_dir_mask = (FS_EVENT_ON_CHILD |FS_MOVED_FROM ); -__u32 new_dir_mask = (FS_EVENT_ON_CHILD |FS_MOVED_TO ); +__u32 old_dir_mask =FS_MOVED_FROM ; +__u32 new_dir_mask =FS_MOVED_TO ;const unsigned char *new_name = moved->d_name.name;if (old_dir == new_dir)
@@ -86,8 +108,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,fsnotify (old_dir, old_dir_mask, source,FSNOTIFY_EVENT_INODE , old_name, fs_cookie); -fsnotify (new_dir, new_dir_mask, moved,FSNOTIFY_EVENT_DENTRY , new_name, - fs_cookie); +fsnotify_filename (moved->d_parent, new_dir_mask, new_name, fs_cookie);if (target)fsnotify_link_count (target);
@@ -123,7 +144,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)if (isdir) mask |=FS_ISDIR ; -fsnotify_parent (NULL , dentry, mask); +fsnotify_d_name (dentry, mask); }/*
@@ -142,7 +163,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) {audit_inode_child (inode, dentry,AUDIT_TYPE_CHILD_CREATE ); -fsnotify (inode,FS_CREATE , dentry,FSNOTIFY_EVENT_DENTRY , dentry->d_name.name,0 ); +fsnotify_d_name (dentry,FS_CREATE ); }/*
@@ -155,7 +176,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, structfsnotify_link_count (inode);audit_inode_child (dir, new_dentry,AUDIT_TYPE_CHILD_CREATE ); -fsnotify (dir,FS_CREATE , new_dentry,FSNOTIFY_EVENT_DENTRY , new_dentry->d_name.name,0 ); +fsnotify_d_name (new_dentry,FS_CREATE ); }/*
@@ -167,7 +188,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)audit_inode_child (inode, dentry,AUDIT_TYPE_CHILD_CREATE ); -fsnotify (inode, mask, dentry,FSNOTIFY_EVENT_DENTRY , dentry->d_name.name,0 ); +fsnotify_d_name (dentry, mask); }/*
Signature · 1 line
2.7.4
Amir Goldstein
reviewerPATCH 3/4 fsnotify: simplify API for filename events
In reply to Amir GoldsteinDo not pass redundant parent inode arg.
--- arch/powerpc/platforms/cell/spufs/inode.c | 2 +- fs/btrfs/ioctl.c | 2 +- fs/debugfs/inode.c | 6 +++--- fs/devpts/inode.c | 2 +- fs/namei.c | 16 ++++++++-------- fs/ocfs2/refcounttree.c | 2 +- fs/tracefs/inode.c | 4 ++-- include/linux/fsnotify.h | 20 +++++++++++++------- net/sunrpc/rpc_pipe.c | 6 +++--- 9 files changed, 33 insertions(+), 27 deletions(-)
arch/powerpc/platforms/cell/spufs/inode.c +1 -1
@@ -587,7 +587,7 @@ long spufs_create(struct path *path, struct dentry *dentry, ret =spufs_create_context (dir, dentry, path->mnt, flags, mode, filp);if (ret >=0 ) -fsnotify_mkdir (dir, dentry); +fsnotify_mkdir (dentry);return ret; }
fs/btrfs/ioctl.c +1 -1
@@ -881,7 +881,7 @@ static noinline int btrfs_mksubvol(const struct path *parent, async_transid, inherit); }if (!error) -fsnotify_mkdir (dir, dentry); +fsnotify_mkdir (dentry); out_up_read:up_read (&fs_info->subvol_sem); out_dput:
fs/debugfs/inode.c +3 -3
@@ -327,7 +327,7 @@ static struct dentry *__debugfs_create_file(const char *name, umode_t mode, dentry->d_fsdata = (void *)real_fops;d_instantiate (dentry, inode); -fsnotify_create (d_inode (dentry->d_parent), dentry); +fsnotify_create (dentry);return end_creating (dentry); }
@@ -486,7 +486,7 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)inc_nlink (inode);d_instantiate (dentry, inode);inc_nlink (d_inode (dentry->d_parent)); -fsnotify_mkdir (d_inode (dentry->d_parent), dentry); +fsnotify_mkdir (dentry);return end_creating (dentry); }EXPORT_SYMBOL_GPL (debugfs_create_dir);
@@ -525,7 +525,7 @@ struct dentry *debugfs_create_automount(const char *name,inc_nlink (inode);d_instantiate (dentry, inode);inc_nlink (d_inode (dentry->d_parent)); -fsnotify_mkdir (d_inode (dentry->d_parent), dentry); +fsnotify_mkdir (dentry);return end_creating (dentry); }EXPORT_SYMBOL (debugfs_create_automount);
fs/devpts/inode.c +1 -1
@@ -549,7 +549,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)if (dentry) { dentry->d_fsdata = priv;d_add (dentry, inode); -fsnotify_create (d_inode (root), dentry); +fsnotify_create (dentry); }else {iput (inode); dentry =ERR_PTR (-ENOMEM );
fs/namei.c +8 -8
@@ -2851,7 +2851,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,return error; error = dir->i_op->create (dir, dentry, mode, want_excl);if (!error) -fsnotify_create (dir, dentry); +fsnotify_create (dentry);return error; }EXPORT_SYMBOL (vfs_create);
@@ -2995,7 +2995,7 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,int acc_mode = op->acc_mode;if (*opened &FILE_CREATED ) {WARN_ON (!(open_flag &O_CREAT )); -fsnotify_create (dir, dentry); +fsnotify_create (dentry); acc_mode =0 ; } error =may_open (&file->f_path, acc_mode, open_flag);
@@ -3010,7 +3010,7 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, dentry = file->f_path.dentry; }if (*opened &FILE_CREATED ) -fsnotify_create (dir, dentry); +fsnotify_create (dentry);if (unlikely (d_is_negative (dentry))) { error = -ENOENT ; }else {
@@ -3156,7 +3156,7 @@ static int lookup_open(struct nameidata *nd, struct path *path, open_flag & O_EXCL);if (error) goto out_dput; -fsnotify_create (dir_inode, dentry); +fsnotify_create (dentry); }if (unlikely (create_error) && !dentry->d_inode) { error = create_error;
@@ -3645,7 +3645,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) error = dir->i_op->mknod (dir, dentry, mode, dev);if (!error) -fsnotify_create (dir, dentry); +fsnotify_create (dentry);return error; }EXPORT_SYMBOL (vfs_mknod);
@@ -3737,7 +3737,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) error = dir->i_op->mkdir (dir, dentry, mode);if (!error) -fsnotify_mkdir (dir, dentry); +fsnotify_mkdir (dentry);return error; }EXPORT_SYMBOL (vfs_mkdir);
@@ -4044,7 +4044,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) error = dir->i_op->symlink (dir, dentry, oldname);if (!error) -fsnotify_create (dir, dentry); +fsnotify_create (dentry);return error; }EXPORT_SYMBOL (vfs_symlink);
@@ -4160,7 +4160,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de }inode_unlock (inode);if (!error) -fsnotify_link (dir, inode, new_dentry); +fsnotify_link (inode, new_dentry);return error; }EXPORT_SYMBOL (vfs_link);
fs/ocfs2/refcounttree.c +1 -1
@@ -4401,7 +4401,7 @@ static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, error =ocfs2_reflink (old_dentry, dir, new_dentry, preserve);inode_unlock (inode);if (!error) -fsnotify_create (dir, new_dentry); +fsnotify_create (new_dentry);return error; }/*
fs/tracefs/inode.c +2 -2
@@ -412,7 +412,7 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, inode->i_fop = fops ? fops : &tracefs_file_operations; inode->i_private = data;d_instantiate (dentry, inode); -fsnotify_create (dentry->d_parent->d_inode, dentry); +fsnotify_create (dentry);return end_creating (dentry); }
@@ -437,7 +437,7 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,inc_nlink (inode);d_instantiate (dentry, inode);inc_nlink (dentry->d_parent->d_inode); -fsnotify_mkdir (dentry->d_parent->d_inode, dentry); +fsnotify_mkdir (dentry);return end_creating (dentry); }
include/linux/fsnotify.h +13 -7
@@ -47,6 +47,12 @@ static inline int fsnotify_d_name(struct dentry *dentry, __u32 mask) dentry->d_name.name, 0); } +static inline void audit_dentry_child (const struct dentry *dentry, +const unsigned char type) +{ +audit_inode_child (d_inode (dentry->d_parent), dentry, type); +} +/* simple call site for access decisions */ static inline int fsnotify_perm (struct file *file,int mask) {
@@ -115,7 +121,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,if (source)fsnotify (source,FS_MOVE_SELF , moved,FSNOTIFY_EVENT_DENTRY ,NULL ,0 ); -audit_inode_child (new_dir, moved,AUDIT_TYPE_CHILD_CREATE ); +audit_dentry_child (moved,AUDIT_TYPE_CHILD_CREATE ); }/*
@@ -159,9 +165,9 @@ static inline void fsnotify_inoderemove(struct inode *inode)/* * fsnotify_create - 'name' was linked in */ -static inline void fsnotify_create (struct inode *inode,struct dentry *dentry) +static inline void fsnotify_create (struct dentry *dentry) { -audit_inode_child (inode, dentry,AUDIT_TYPE_CHILD_CREATE ); +audit_dentry_child (dentry,AUDIT_TYPE_CHILD_CREATE );fsnotify_d_name (dentry,FS_CREATE ); }
@@ -171,10 +177,10 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)* Note: We have to pass also the linked inode ptr as some filesystems leave * new_dentry->d_inode NULL and instantiate inode pointer later */ -static inline void fsnotify_link (struct inode *dir,struct inode *inode,struct dentry *new_dentry) +static inline void fsnotify_link (struct inode *inode,struct dentry *new_dentry) {fsnotify_link_count (inode); -audit_inode_child (dir, new_dentry,AUDIT_TYPE_CHILD_CREATE ); +audit_dentry_child (new_dentry,AUDIT_TYPE_CHILD_CREATE );fsnotify_d_name (new_dentry,FS_CREATE ); }
@@ -182,11 +188,11 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct/* * fsnotify_mkdir - directory 'name' was created */ -static inline void fsnotify_mkdir (struct inode *inode,struct dentry *dentry) +static inline void fsnotify_mkdir (struct dentry *dentry) {__u32 mask = (FS_CREATE |FS_ISDIR ); -audit_inode_child (inode, dentry,AUDIT_TYPE_CHILD_CREATE ); +audit_dentry_child (dentry,AUDIT_TYPE_CHILD_CREATE );fsnotify_d_name (dentry, mask); }
net/sunrpc/rpc_pipe.c +3 -3
@@ -524,7 +524,7 @@ static int __rpc_create(struct inode *dir, struct dentry *dentry, err =__rpc_create_common (dir, dentry,S_IFREG | mode, i_fop, private);if (err)return err; -fsnotify_create (dir, dentry); +fsnotify_create (dentry);return 0 ; }
@@ -539,7 +539,7 @@ static int __rpc_mkdir(struct inode *dir, struct dentry *dentry,if (err)return err;inc_nlink (dir); -fsnotify_mkdir (dir, dentry); +fsnotify_mkdir (dentry);return 0 ; }
@@ -594,7 +594,7 @@ static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry, rpci =RPC_I (d_inode (dentry)); rpci->private = private; rpci->pipe = pipe; -fsnotify_create (dir, dentry); +fsnotify_create (dentry);return 0 ; }
Signature · 1 line
2.7.4
Amir Goldstein
reviewerPATCH 4/4 fsnotify: make MOVED_FROM a dentry event
In reply to Amir GoldsteinPropagate old/new parent dentries to fsnotify_move() and pass old parent dentry as FSNOTIFY_DENTRY info of MOVED_FROM event.
This change has no effect on current backends. Soon, this will allow fanotify backend to get MOVED_FROM events.
--- fs/debugfs/inode.c | 2 +- fs/namei.c | 7 +++++-- include/linux/fsnotify.h | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-)
fs/debugfs/inode.c +1 -1
@@ -754,7 +754,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, goto exit; }d_move (old_dentry, dentry); -fsnotify_move (d_inode (old_dir),d_inode (new_dir), old_name, +fsnotify_move (old_dir, new_dir, old_name,d_is_dir (old_dentry),NULL , old_dentry);fsnotify_oldname_free (old_name);
fs/namei.c +5 -2
@@ -4300,6 +4300,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,int error;bool is_dir =d_is_dir (old_dentry);const unsigned char *old_name; +struct dentry *old_parent = old_dentry->d_parent; +struct dentry *new_parent = new_dentry->d_parent;struct inode *source = old_dentry->d_inode;struct inode *target = new_dentry->d_inode;bool new_is_dir = false;
@@ -4405,10 +4407,11 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,inode_unlock (target);dput (new_dentry);if (!error) { -fsnotify_move (old_dir, new_dir, old_name, is_dir, +fsnotify_move (old_parent, new_parent, old_name, is_dir, !(flags &RENAME_EXCHANGE ) ? target :NULL , old_dentry);if (flags &RENAME_EXCHANGE ) { -fsnotify_move (new_dir, old_dir, old_dentry->d_name.name, +fsnotify_move (new_parent, old_parent, + old_dentry->d_name.name, new_is_dir,NULL , new_dentry); } }
include/linux/fsnotify.h +10 -8
@@ -94,17 +94,19 @@ static inline void fsnotify_link_count(struct inode *inode)/* * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir */ -static inline void fsnotify_move (struct inode *old_dir,struct inode *new_dir, +static inline void fsnotify_move (struct dentry *old_dir, +struct dentry *new_dir,const unsigned char *old_name, -int isdir,struct inode *target,struct dentry *moved) +int isdir,struct inode *target, +struct dentry *moved) { -struct inode *source = moved->d_inode; +struct inode *source =d_inode (moved);u32 fs_cookie =fsnotify_get_cookie ();__u32 old_dir_mask =FS_MOVED_FROM ;__u32 new_dir_mask =FS_MOVED_TO ;const unsigned char *new_name = moved->d_name.name; -if (old_dir == new_dir) +if (d_inode (old_dir) ==d_inode (new_dir)) old_dir_mask |=FS_DN_RENAME ;if (isdir) {
@@ -112,15 +114,15 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, new_dir_mask |=FS_ISDIR ; } -fsnotify (old_dir, old_dir_mask, source,FSNOTIFY_EVENT_INODE , old_name, - fs_cookie); -fsnotify_filename (moved->d_parent, new_dir_mask, new_name, fs_cookie); +fsnotify_filename (old_dir, old_dir_mask, old_name, fs_cookie); +fsnotify_filename (new_dir, new_dir_mask, new_name, fs_cookie);if (target)fsnotify_link_count (target);if (source) -fsnotify (source,FS_MOVE_SELF , moved,FSNOTIFY_EVENT_DENTRY ,NULL ,0 ); +fsnotify (source,FS_MOVE_SELF , moved,FSNOTIFY_EVENT_DENTRY , +NULL ,0 );audit_dentry_child (moved,AUDIT_TYPE_CHILD_CREATE ); }
Signature · 1 line
2.7.4