mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* NFS and dnotify.
@ 2003-11-07 15:33 Terje Malmedal
  0 siblings, 0 replies; only message in thread
From: Terje Malmedal @ 2003-11-07 15:33 UTC (permalink / raw)
  To: linux-kernel


Programs running on an NFS-server won't get dnotify-events when
NFS-clients change files. This is a problem with filesystems which are
exported with both NFS and Samba. Typically a Windooze-system running
IIS and ASP will not pick up changes made via NFS because of this.

The following patch fixes the problem for me at least. I'm not
familiar with the internals so possibly there are better ways of doing
this, but it seems pretty straightforward.

Obviously the DN_ACCESS part does not work when the client already has
cached the file. The important thing is that DN_MODIFY works.

The patch is actually against RedHat's 2.4.20-20.9, but the code in
question is identical in stock 2.4.22.

It would be very nice if this or something like it could get into the
standard kernel.

--- fs/nfsd/vfs.c.org	2003-11-07 14:18:33.000000000 +0100
+++ fs/nfsd/vfs.c	2003-11-07 15:31:12.000000000 +0100
@@ -42,7 +42,7 @@
 #endif /* CONFIG_NFSD_V3 */
 #include <linux/nfsd/nfsfh.h>
 #include <linux/quotaops.h>
-
+#include <linux/dnotify.h>
 #include <asm/uaccess.h>
 
 #define NFSDDBG_FACILITY		NFSDDBG_FILEOP
@@ -627,6 +627,9 @@
 	err = file.f_op->read(&file, buf, *count, &file.f_pos);
 	set_fs(oldfs);
 
+	if (*count > 0)
+	        dnotify_parent(file.f_dentry, DN_ACCESS);
+
 	/* Write back readahead params */
 	if (ra != NULL) {
 		dprintk("nfsd: raparms %ld %ld %ld %ld %ld\n",
@@ -711,8 +714,10 @@
 	/* Write the data. */
 	oldfs = get_fs(); set_fs(KERNEL_DS);
 	err = file.f_op->write(&file, buf, cnt, &file.f_pos);
-	if (err >= 0)
+	if (err >= 0) {
 		nfsdstats.io_write += cnt;
+	        dnotify_parent(file.f_dentry, DN_MODIFY);
+	}
 	set_fs(oldfs);
 
 	/* clear setuid/setgid flag after write */

-- 
 - Terje
malmedal@usit.uio.no

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-07 23:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-07 15:33 NFS and dnotify Terje Malmedal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®