Skip to content

Commit

Permalink
NFS: Fix an Oops in nfs_setattr()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Trond Myklebust authored and Linus Torvalds committed Apr 15, 2007
1 parent c9c5792 commit e1552e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
* ... 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);
Expand Down
6 changes: 4 additions & 2 deletions fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit e1552e1

Please sign in to comment.