]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
NFS: Fix an Oops in nfs_setattr()
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Sat, 14 Apr 2007 23:07:28 +0000 (19:07 -0400)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 15 Apr 2007 04:46:47 +0000 (21:46 -0700)
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>
fs/nfs/dir.c
fs/nfs/inode.c

index 92d8ec859e224170a20cc24c728b3af582b4c60e..cd3469720cbf9e08e07ac085f98255e2d7ade549 100644 (file)
@@ -1684,7 +1684,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 93d046c85f5245c9be6a335f4cbc3f2721c8f4c9..44aa9b726573b2685d0007c27876b13fe4a5ef2f 100644 (file)
@@ -341,8 +341,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
         */