Commit d0769f55 authored by Trond Myklebust's avatar Trond Myklebust Committed by Greg Kroah-Hartman

NFS: Fix an Oops in nfs_setattr()

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 12b1ca66
...@@ -1659,6 +1659,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1659,6 +1659,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
* ... prune child dentries and writebacks if needed. * ... prune child dentries and writebacks if needed.
*/ */
if (atomic_read(&old_dentry->d_count) > 1) { if (atomic_read(&old_dentry->d_count) > 1) {
if (S_ISREG(old_inode->i_mode))
nfs_wb_all(old_inode); nfs_wb_all(old_inode);
shrink_dcache_parent(old_dentry); shrink_dcache_parent(old_dentry);
} }
......
...@@ -334,8 +334,10 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -334,8 +334,10 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
lock_kernel(); lock_kernel();
nfs_begin_data_update(inode); nfs_begin_data_update(inode);
/* Write all dirty data */ /* Write all dirty data */
if (S_ISREG(inode->i_mode)) {
filemap_write_and_wait(inode->i_mapping); filemap_write_and_wait(inode->i_mapping);
nfs_wb_all(inode); nfs_wb_all(inode);
}
/* /*
* Return any delegations if we're going to change ACLs * Return any delegations if we're going to change ACLs
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment