lkml.org 
[lkml]   [2003]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectNFS and dnotify.
Date

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.028 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site