Skip to content

Commit f4ec3a3

Browse files
author
Al Viro
committed
switch fsnotify_move() to passing const struct qstr * for old_name
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>
1 parent 230c640 commit f4ec3a3

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎fs/debugfs/inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
819819
goto exit;
820820
}
821821
d_move(old_dentry, dentry);
822-
fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name.name.name,
822+
fsnotify_move(d_inode(old_dir), d_inode(new_dir), &old_name.name,
823823
d_is_dir(old_dentry),
824824
NULL, old_dentry);
825825
release_dentry_name_snapshot(&old_name);

‎fs/namei.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4498,10 +4498,10 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
44984498
inode_unlock(target);
44994499
dput(new_dentry);
45004500
if (!error) {
4501-
fsnotify_move(old_dir, new_dir, old_name.name.name, is_dir,
4501+
fsnotify_move(old_dir, new_dir, &old_name.name, is_dir,
45024502
!(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry);
45034503
if (flags & RENAME_EXCHANGE) {
4504-
fsnotify_move(new_dir, old_dir, old_dentry->d_name.name,
4504+
fsnotify_move(new_dir, old_dir, &old_dentry->d_name,
45054505
new_is_dir, NULL, new_dentry);
45064506
}
45074507
}

‎include/linux/fsnotify.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static inline void fsnotify_link_count(struct inode *inode)
102102
* fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
103103
*/
104104
static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
105-
const unsigned char *old_name,
105+
const struct qstr *old_name,
106106
int isdir, struct inode *target,
107107
struct dentry *moved)
108108
{
@@ -122,7 +122,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
122122
mask |= FS_ISDIR;
123123
}
124124

125-
fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,
125+
fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name->name,
126126
fs_cookie);
127127
fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
128128
fs_cookie);

0 commit comments

Comments
 (0)