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>
This commit is contained in:
Trond Myklebust 2007-04-14 19:07:28 -04:00 коммит произвёл Linus Torvalds
Родитель c9c57929d2
Коммит e1552e1998
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -1684,7 +1684,8 @@ go_ahead:
* ... 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) {
nfs_wb_all(old_inode); if (S_ISREG(old_inode->i_mode))
nfs_wb_all(old_inode);
shrink_dcache_parent(old_dentry); shrink_dcache_parent(old_dentry);
} }
nfs_inode_return_delegation(old_inode); nfs_inode_return_delegation(old_inode);

Просмотреть файл

@ -341,8 +341,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 */
filemap_write_and_wait(inode->i_mapping); if (S_ISREG(inode->i_mode)) {
nfs_wb_all(inode); filemap_write_and_wait(inode->i_mapping);
nfs_wb_all(inode);
}
/* /*
* Return any delegations if we're going to change ACLs * Return any delegations if we're going to change ACLs
*/ */