Commit 59cf7a51 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: Make sure dnotify events happen for NFS read and write.

From: NeilBrown <neilb@cse.unsw.edu.au>

Based on code from Terje Malmedal <terje.malmedal@usit.uio.no>
parent d1a8cd1a
...@@ -165,6 +165,7 @@ void dnotify_parent(struct dentry *dentry, unsigned long event) ...@@ -165,6 +165,7 @@ void dnotify_parent(struct dentry *dentry, unsigned long event)
spin_unlock(&dentry->d_lock); spin_unlock(&dentry->d_lock);
} }
} }
EXPORT_SYMBOL_GPL(dnotify_parent);
static int __init dnotify_init(void) static int __init dnotify_init(void)
{ {
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#endif /* CONFIG_NFSD_V3 */ #endif /* CONFIG_NFSD_V3 */
#include <linux/nfsd/nfsfh.h> #include <linux/nfsd/nfsfh.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/dnotify.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -680,6 +681,7 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, ...@@ -680,6 +681,7 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
nfsdstats.io_read += err; nfsdstats.io_read += err;
*count = err; *count = err;
err = 0; err = 0;
dnotify_parent(file.f_dentry, DN_ACCESS);
} else } else
err = nfserrno(err); err = nfserrno(err);
out_close: out_close:
...@@ -745,9 +747,11 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, ...@@ -745,9 +747,11 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
/* Write the data. */ /* Write the data. */
oldfs = get_fs(); set_fs(KERNEL_DS); oldfs = get_fs(); set_fs(KERNEL_DS);
err = vfs_writev(&file, vec, vlen, &offset); err = vfs_writev(&file, vec, vlen, &offset);
if (err >= 0)
nfsdstats.io_write += cnt;
set_fs(oldfs); set_fs(oldfs);
if (err >= 0) {
nfsdstats.io_write += cnt;
dnotify_parent(file.f_dentry, DN_MODIFY);
}
/* clear setuid/setgid flag after write */ /* clear setuid/setgid flag after write */
if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) { if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment