mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Terje Malmedal <terje.malmedal@usit.uio.no>
To: linux-kernel@vger.kernel.org
Subject: NFS and dnotify.
Date: Fri, 7 Nov 2003 16:33:18 +0100	[thread overview]
Message-ID: <E1AI8bu-0004RC-00@aqualene.uio.no> (raw)


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

                 reply	other threads:[~2003-11-07 23:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1AI8bu-0004RC-00@aqualene.uio.no \
    --to=terje.malmedal@usit.uio.no \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®