switch fsnotify_move() to passing const struct qstr * for old_name
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 26 Apr 2019 17:21:24 +0000 (13:21 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 26 Apr 2019 17:22:05 +0000 (13:22 -0400)
note that in the second (RENAME_EXCHANGE) call of fsnotify_move() in
vfs_rename() the old_dentry->d_name is guaranteed to be unchanged
throughout the evaluation of fsnotify_move() (by the fact that the
parent directory is locked exclusive), so we don't need to fetch
old_dentry->d_name.name in the caller.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/debugfs/inode.c
fs/namei.c
include/linux/fsnotify.h

index f7064048d27171e744d1945ee3876a8a4bf0451f..8b8225211a1467b22453d5b269e39db24295ab45 100644 (file)
@@ -819,7 +819,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.name.name,
+       fsnotify_move(d_inode(old_dir), d_inode(new_dir), &old_name.name,
                d_is_dir(old_dentry),
                NULL, old_dentry);
        release_dentry_name_snapshot(&old_name);
index c96713077326321d19717bea5687955cf9dba895..5ebd64b2197023bb7dd704303307bfd9086d7a0f 100644 (file)
@@ -4498,10 +4498,10 @@ out:
                inode_unlock(target);
        dput(new_dentry);
        if (!error) {
-               fsnotify_move(old_dir, new_dir, old_name.name.name, is_dir,
+               fsnotify_move(old_dir, new_dir, &old_name.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_dir, old_dir, &old_dentry->d_name,
                                      new_is_dir, NULL, new_dentry);
                }
        }
index e09cfff69bb241426e6c59777974fd9e032b8dad..f816bd29b82c8e3160655acf6359b709103f865f 100644 (file)
@@ -102,7 +102,7 @@ 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,
-                                const unsigned char *old_name,
+                                const struct qstr *old_name,
                                 int isdir, struct inode *target,
                                 struct dentry *moved)
 {
@@ -122,7 +122,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
                mask |= FS_ISDIR;
        }
 
-       fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,
+       fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name->name,
                 fs_cookie);
        fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
                 fs_cookie);