From 80d383c0fd8950c25ac382309cb60c791bb9d461 Mon Sep 17 00:00:00 2001 From: Eric Paris Date: Thu, 17 Dec 2009 21:24:21 -0500 Subject: [PATCH] --- yaml --- r: 207623 b: refs/heads/master c: 2a12a9d7814631e918dec93abad856e692d5286d h: refs/heads/master i: 207621: 815569a7121bac2ee0ad97d8c9b7736464433db5 207619: dd0e26b7e8786e48c6ebd134079d0ad6b4445499 207615: 2cf588617a9837f0dfa716d3430358f492eaa32b v: v3 --- [refs] | 2 +- trunk/fs/compat.c | 5 ++--- trunk/fs/exec.c | 4 ++-- trunk/fs/nfsd/vfs.c | 4 ++-- trunk/fs/open.c | 2 +- trunk/fs/read_write.c | 8 ++++---- trunk/include/linux/fsnotify.h | 15 +++++++++------ 7 files changed, 21 insertions(+), 19 deletions(-) diff --git a/[refs] b/[refs] index c37d81e4678c..99e4d8b3e8ca 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8112e2d6a7356e8c3ff1f7f3c86f375ed0305705 +refs/heads/master: 2a12a9d7814631e918dec93abad856e692d5286d diff --git a/trunk/fs/compat.c b/trunk/fs/compat.c index 6490d2134ff3..ce02278b9c83 100644 --- a/trunk/fs/compat.c +++ b/trunk/fs/compat.c @@ -1193,11 +1193,10 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, 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; } diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index e19de6a80339..f2de04a01a2a 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -129,7 +129,7 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) goto exit; - fsnotify_open(file->f_path.dentry); + fsnotify_open(file); error = -ENOEXEC; if(file->f_op) { @@ -683,7 +683,7 @@ struct file *open_exec(const char *name) if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) goto exit; - fsnotify_open(file->f_path.dentry); + fsnotify_open(file); err = deny_write_access(file); if (err) diff --git a/trunk/fs/nfsd/vfs.c b/trunk/fs/nfsd/vfs.c index 3c111120b619..16114a8e79d4 100644 --- a/trunk/fs/nfsd/vfs.c +++ b/trunk/fs/nfsd/vfs.c @@ -951,7 +951,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: @@ -1062,7 +1062,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, goto out_nfserr; *cnt = host_err; nfsdstats.io_write += host_err; - fsnotify_modify(file->f_path.dentry); + fsnotify_modify(file); /* clear setuid/setgid flag after write */ if (inode->i_mode & (S_ISUID | S_ISGID)) diff --git a/trunk/fs/open.c b/trunk/fs/open.c index 94d54d3efa8b..bf082635e257 100644 --- a/trunk/fs/open.c +++ b/trunk/fs/open.c @@ -889,7 +889,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); } } diff --git a/trunk/fs/read_write.c b/trunk/fs/read_write.c index 9c0485236e68..74e36586e4d3 100644 --- a/trunk/fs/read_write.c +++ b/trunk/fs/read_write.c @@ -311,7 +311,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); @@ -367,7 +367,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); @@ -675,9 +675,9 @@ static ssize_t do_readv_writev(int type, struct file *file, 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; } diff --git a/trunk/include/linux/fsnotify.h b/trunk/include/linux/fsnotify.h index f958e93feb97..845e57abfb86 100644 --- a/trunk/include/linux/fsnotify.h +++ b/trunk/include/linux/fsnotify.h @@ -153,8 +153,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 = FS_ACCESS; @@ -162,14 +163,15 @@ static inline void fsnotify_access(struct dentry *dentry) mask |= FS_IN_ISDIR; fsnotify_parent(dentry, mask); - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); + fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); } /* * 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 = FS_MODIFY; @@ -177,14 +179,15 @@ static inline void fsnotify_modify(struct dentry *dentry) mask |= FS_IN_ISDIR; fsnotify_parent(dentry, mask); - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); + fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); } /* * 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 = FS_OPEN; @@ -192,7 +195,7 @@ static inline void fsnotify_open(struct dentry *dentry) mask |= FS_IN_ISDIR; fsnotify_parent(dentry, mask); - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); + fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); } /*