Skip to contentSkip to conversation

kNFSd - 4 of 6 - Make sure dnotify events happen for NFS read and write.

PATCH In review NeilBrown 2 participants 2 messages Jan 16, 2004

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 4 of 6 - Make sure dnotify events happen for NFS read and write.

Based on code from Terje Malmedal <[email protected]>

----------- Diffstat output ------------

 ./fs/nfsd/vfs.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +6 -2
diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
@@ -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
 		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, struc
 	/* 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))) {

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw

With this patch (applied to a generic 2.6.1 kernel tree), 'make install_modules' complains with:

WARNING: /lib/modules/2.6.1/kernel/fs/nfsd/nfsd.ko needs unknown symbol dnotify_parent

Adding:

EXPORT_SYMBOL(dnotify_parent);

to fs/dnotify.c appears to fix this.

James Pearson

Quoted 42 lines · NeilBrown

Based on code from Terje Malmedal <[email protected]>

----------- Diffstat output ------------

 ./fs/nfsd/vfs.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c

fs/nfsd/vfs.c 2004-01-16 12:21:25.000000000 +1100 renamed from fs/nfsd/vfs.c~current~ 2004-01-16 12:20:18.000000000 +1100 +6 -3
@@ -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
                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, struc
        /* 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))) {
 
-------------------------------------------------------
Quoted 7 lines

The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs