aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-04-14 19:07:28 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-15 00:46:47 -0400
commite1552e199857109d4b25b9163eff4646726eee3d (patch)
tree344af8502076a414c7b579bc33e0c98f21a20b2c /fs/nfs
parentc9c57929d23e44f258d1b6e7f089e72c85f0bd1c (diff)
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/dir.c3
-rw-r--r--fs/nfs/inode.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 92d8ec859e22..cd3469720cbf 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1684,7 +1684,8 @@ go_ahead:
1684 * ... prune child dentries and writebacks if needed. 1684 * ... prune child dentries and writebacks if needed.
1685 */ 1685 */
1686 if (atomic_read(&old_dentry->d_count) > 1) { 1686 if (atomic_read(&old_dentry->d_count) > 1) {
1687 nfs_wb_all(old_inode); 1687 if (S_ISREG(old_inode->i_mode))
1688 nfs_wb_all(old_inode);
1688 shrink_dcache_parent(old_dentry); 1689 shrink_dcache_parent(old_dentry);
1689 } 1690 }
1690 nfs_inode_return_delegation(old_inode); 1691 nfs_inode_return_delegation(old_inode);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 93d046c85f52..44aa9b726573 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -341,8 +341,10 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
341 lock_kernel(); 341 lock_kernel();
342 nfs_begin_data_update(inode); 342 nfs_begin_data_update(inode);
343 /* Write all dirty data */ 343 /* Write all dirty data */
344 filemap_write_and_wait(inode->i_mapping); 344 if (S_ISREG(inode->i_mode)) {
345 nfs_wb_all(inode); 345 filemap_write_and_wait(inode->i_mapping);
346 nfs_wb_all(inode);
347 }
346 /* 348 /*
347 * Return any delegations if we're going to change ACLs 349 * Return any delegations if we're going to change ACLs
348 */ 350 */