fsnotify: pass a file instead of an inode to open modify and read
Subsystems (3)
RFC 2/11 fsnotify: pass a file instead of an inode to open modify and read
pass a file instead of an inode to open, modify, close
From: Eric Paris <[email protected]>
Signed-off-by Eric Paris <[email protected]>
---
fs/compat.c | 5 ++--- fs/nfsd/vfs.c | 4 ++-- fs/open.c | 2 +- fs/read_write.c | 8 ++++---- include/linux/fsnotify.h | 9 ++++++--- 5 files changed, 15 insertions(+), 13 deletions(-)
fs/compat.c +2 -3
@@ -1125,11 +1125,10 @@ out:if (iov != iovstack)kfree (iov);if ((ret + (type ==READ )) >0 ) { -struct dentry *dentry = file->f_path.dentry;if (type ==READ ) -fsnotify_access (dentry); +fsnotify_access (file);else -fsnotify_modify (dentry); +fsnotify_modify (file); }return ret; }
fs/nfsd/vfs.c +2 -2
@@ -937,7 +937,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, nfsdstats.io_read += host_err; *count = host_err; err =0 ; -fsnotify_access (file->f_path.dentry); +fsnotify_access (file); }else err =nfserrno (host_err); out:
@@ -1004,7 +1004,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,set_fs (oldfs);if (host_err >=0 ) { nfsdstats.io_write += cnt; -fsnotify_modify (file->f_path.dentry); +fsnotify_modify (file); }/* clear setuid/setgid flag after write */
fs/open.c +1 -1
@@ -1020,7 +1020,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)put_unused_fd (fd); fd =PTR_ERR (f); }else { -fsnotify_open (f->f_path.dentry); +fsnotify_open (f);fd_install (fd, f); } }
fs/read_write.c +4 -4
@@ -258,7 +258,7 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)else ret =do_sync_read (file, buf, count, pos);if (ret >0 ) { -fsnotify_access (file->f_path.dentry); +fsnotify_access (file);add_rchar (current, ret); }inc_syscr (current);
@@ -313,7 +313,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_else ret =do_sync_write (file, buf, count, pos);if (ret >0 ) { -fsnotify_modify (file->f_path.dentry); +fsnotify_modify (file);add_wchar (current, ret); }inc_syscw (current);
@@ -604,9 +604,9 @@ out:kfree (iov);if ((ret + (type ==READ )) >0 ) {if (type ==READ ) -fsnotify_access (file->f_path.dentry); +fsnotify_access (file);else -fsnotify_modify (file->f_path.dentry); +fsnotify_modify (file); }return ret; }
include/linux/fsnotify.h +6 -3
@@ -136,8 +136,9 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)/* * fsnotify_access - file was read */ -static inline void fsnotify_access (struct dentry *dentry) +static inline void fsnotify_access (struct file *file) { +struct dentry *dentry = file->f_path.dentry;struct inode *inode = dentry->d_inode;u32 mask =IN_ACCESS ;
@@ -152,8 +153,9 @@ static inline void fsnotify_access(struct dentry *dentry)/* * fsnotify_modify - file was modified */ -static inline void fsnotify_modify (struct dentry *dentry) +static inline void fsnotify_modify (struct file *file) { +struct dentry *dentry = file->f_path.dentry;struct inode *inode = dentry->d_inode;u32 mask =IN_MODIFY ;
@@ -168,8 +170,9 @@ static inline void fsnotify_modify(struct dentry *dentry)/* * fsnotify_open - file was opened */ -static inline void fsnotify_open (struct dentry *dentry) +static inline void fsnotify_open (struct file *file) { +struct dentry *dentry = file->f_path.dentry;struct inode *inode = dentry->d_inode;u32 mask =IN_OPEN ;
Quoted 1 line · Eric Paris
pass a file instead of an inode to open, modify, close
Why? It would be helpful to describe the need for this change in this log comment.
thanks,
greg k-h