History

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.

Al Viro committed 7 years ago

Commit f4ec3a31 parent 230c6403 files · +5 −5Browse files

Unified · Split

3 files
  1. fs/debugfs/inode.c +1 −1
  2. fs/namei.c +2 −2
  3. include/linux/fsnotify.h +2 −2
fs/debugfs/inode.c+1−1
@@ -819,7 +819,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, · 818 unmodified lines
819 goto exit;819 goto exit;
820 }820 }
821 d_move(old_dentry, dentry);821 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,
823 d_is_dir(old_dentry),823 d_is_dir(old_dentry),
824 NULL, old_dentry);824 NULL, old_dentry);
825 release_dentry_name_snapshot(&old_name);825 release_dentry_name_snapshot(&old_name);
fs/namei.c+2−2
@@ -4498,10 +4498,10 @@ out: · 4497 unmodified lines
4498 inode_unlock(target);4498 inode_unlock(target);
4499 dput(new_dentry);4499 dput(new_dentry);
4500 if (!error) {4500 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,
4502 !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry);4502 !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry);
4503 if (flags & RENAME_EXCHANGE) {4503 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,
4505 new_is_dir, NULL, new_dentry);4505 new_is_dir, NULL, new_dentry);
4506 }4506 }
4507 }4507 }
include/linux/fsnotify.h+2−2
@@ -102,7 +102,7 @@ static inline void fsnotify_link_count(struct inode *inode) · 101 unmodified lines
102 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir102 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
103 */103 */
104static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,104static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
105 const unsigned char *old_name,105 const struct qstr *old_name,
106 int isdir, struct inode *target,106 int isdir, struct inode *target,
107 struct dentry *moved)107 struct dentry *moved)
108{108{
@@ -122,7 +122,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 13 unmodified lines
122 mask |= FS_ISDIR;122 mask |= FS_ISDIR;
123 }123 }
124 124
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,
126 fs_cookie);126 fs_cookie);
127 fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,127 fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
128 fs_cookie);128 fs_cookie);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t