]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
NFS: Fix an Oops in nfs_setattr()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 19 Apr 2007 20:31:23 +0000 (16:31 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 2 May 2007 00:05:59 +0000 (17:05 -0700)
NFS: Fix an Oops in nfs_setattr()

It looks like nfs_setattr() and nfs_rename() also need to test whether the
target is a regular file before calling nfs_wb_all()...

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfs/dir.c
fs/nfs/inode.c

index d9ba8cb0ee75b22b8618f1fe9f75dd13b2cb9259..80b4264d4ea31830d67797aeb32b7a8581685e2d 100644 (file)
@@ -1659,7 +1659,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 5a83e8d6ecb33ea8979f37abea0369f837e735c8..e8cacef4f8ecd66b73cfe9f3218fc5807a80c6f0 100644 (file)
@@ -334,8 +334,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
         */