]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
NFS: call nfs_wb_all() only on regular files
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 21 Jan 2008 19:04:16 +0000 (21:04 +0200)
committerAdrian Bunk <bunk@kernel.org>
Mon, 21 Jan 2008 19:04:16 +0000 (21:04 +0200)
It looks like nfs_setattr() and nfs_rename() also need to test whether the
target is a regular file before calling nfs_wb_all()...

It isn't technically needed since the version of nfs_wb_all() that exists
on 2.6.16 should be safe to call on non-regular files (it will be a no-op).
However it is a useful optimisation.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
fs/nfs/dir.c
fs/nfs/inode.c

index 0087a0da3c65a197c634c75f7522577e32caf78f..53c6a8a9ec02d613fe0ebf691dcd8576dd27750f 100644 (file)
@@ -1553,7 +1553,8 @@ go_ahead:
         * ... prune child dentries and writebacks if needed.
         */
        if (atomic_read(&old_dentry->d_count) > 1) {
-               nfs_wb_all(old_inode);
+               if (S_ISREG(old_inode->i_mode))
+                       nfs_wb_all(old_inode);
                shrink_dcache_parent(old_dentry);
        }
        nfs_inode_return_delegation(old_inode);
index 0524a20be3f46582f71251e0393f669692c48b10..8bcba4979e4871691b52cfd7c0eb4a6c0164fd7f 100644 (file)
@@ -860,8 +860,10 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
        lock_kernel();
        nfs_begin_data_update(inode);
        /* Write all dirty data */
-       filemap_write_and_wait(inode->i_mapping);
-       nfs_wb_all(inode);
+       if (S_ISREG(inode->i_mode)) {
+               filemap_write_and_wait(inode->i_mapping);
+               nfs_wb_all(inode);
+       }
        /*
         * Return any delegations if we're going to change ACLs
         */