From: Trond Myklebust If users set the execute bit on a file, and then write to it, remove_suid() causes a flood of SETATTR calls (one per write() syscall) with no arguments to be sent down the wire. The server will in any case clear the suid bit itself without any prompting from us, so the following patch simply filters away all SETATTR requests with empty or unsupported ia_valid fields. --- fs/nfs/inode.c | 9 +++++++++ 1 files changed, 9 insertions(+) diff -puN fs/nfs/inode.c~nfs-fix-bogus-setattr-calls fs/nfs/inode.c --- 25/fs/nfs/inode.c~nfs-fix-bogus-setattr-calls 2004-01-08 18:38:33.000000000 -0800 +++ 25-akpm/fs/nfs/inode.c 2004-01-08 18:38:33.000000000 -0800 @@ -791,6 +791,8 @@ out_no_inode: goto out; } +#define NFS_VALID_ATTRS (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|ATTR_ATIME|ATTR_ATIME_SET|ATTR_MTIME|ATTR_MTIME_SET) + int nfs_setattr(struct dentry *dentry, struct iattr *attr) { @@ -798,6 +800,11 @@ nfs_setattr(struct dentry *dentry, struc struct nfs_fattr fattr; int error; + /* Optimization: if the end result is no change, don't RPC */ + attr->ia_valid &= NFS_VALID_ATTRS; + if (attr->ia_valid == 0) + return 0; + lock_kernel(); /* @@ -813,6 +820,8 @@ printk("nfs_setattr: revalidate failed, if (!S_ISREG(inode->i_mode)) { attr->ia_valid &= ~ATTR_SIZE; + if (attr->ia_valid == 0) + goto out; } else { filemap_fdatawrite(inode->i_mapping); error = nfs_wb_all(inode); _