Re: [Fwd: Strange NFS problem ... Ideas?]

Trond Myklebust (trond.myklebust@fys.uio.no)
02 Mar 1999 19:17:21 +0100


Alan Cox <alan@redhat.com> writes:

> We have another fun NFS bug from some traces. I think its a Linux client bug
>
> Whats happeniong is
>
> write(fd, blah, lots)
> fchmod(fd, setuid)
> close(fd);
>
> is hitting the server as
>
> some writes
> fchmod fd
> writes continue
> close(fd)
>
> The delayed writes clear the setuid bit of course

This is easy to fix, the question though is whether we are required
to? Does fchmod (and fchown) imply 'fsync' or not?

If they do, then the following patch is sufficient (against stock
2.2.2):

Cheers,
Trond

--- linux-2.2.2/fs/nfs/inode.c-2.2.2 Tue Jan 5 22:04:08 1999
+++ linux-2.2.2/fs/nfs/inode.c Tue Mar 2 19:15:37 1999
@@ -596,6 +596,9 @@
if (attr->ia_valid & ATTR_GID)
sattr.gid = attr->ia_gid;

+ if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
+ nfs_wb_all(inode);
+
sattr.size = (u32) -1;
if ((attr->ia_valid & ATTR_SIZE) && S_ISREG(inode->i_mode)) {
sattr.size = attr->ia_size;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/