]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: Make sure dnotify events happen for NFS read and write.
authorAndrew Morton <akpm@osdl.org>
Mon, 19 Jan 2004 02:57:00 +0000 (18:57 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 19 Jan 2004 02:57:00 +0000 (18:57 -0800)
From: NeilBrown <neilb@cse.unsw.edu.au>

Based on code from Terje Malmedal <terje.malmedal@usit.uio.no>

fs/dnotify.c
fs/nfsd/vfs.c

index f5eb816a814e8c9c1106c970e1024eabeffd3538..bd5b433867d5b79437b7c68654ab7b79979d57af 100644 (file)
@@ -165,6 +165,7 @@ void dnotify_parent(struct dentry *dentry, unsigned long event)
                spin_unlock(&dentry->d_lock);
        }
 }
+EXPORT_SYMBOL_GPL(dnotify_parent);
 
 static int __init dnotify_init(void)
 {
index 96cb2eed9c113c79892b33b89d665c87a4ee470a..880b8c4f03e467da2d8033927f3054b18024861c 100644 (file)
@@ -43,6 +43,7 @@
 #endif /* CONFIG_NFSD_V3 */
 #include <linux/nfsd/nfsfh.h>
 #include <linux/quotaops.h>
+#include <linux/dnotify.h>
 
 #include <asm/uaccess.h>
 
@@ -680,6 +681,7 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
                nfsdstats.io_read += err;
                *count = err;
                err = 0;
+               dnotify_parent(file.f_dentry, DN_ACCESS);
        } else 
                err = nfserrno(err);
 out_close:
@@ -745,9 +747,11 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
        /* Write the data. */
        oldfs = get_fs(); set_fs(KERNEL_DS);
        err = vfs_writev(&file, vec, vlen, &offset);
-       if (err >= 0)
-               nfsdstats.io_write += cnt;
        set_fs(oldfs);
+       if (err >= 0) {
+               nfsdstats.io_write += cnt;
+               dnotify_parent(file.f_dentry, DN_MODIFY);
+       }
 
        /* clear setuid/setgid flag after write */
        if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) {