浏览代码

NFS: Fix up "rm -rf"...

When a file is being scheduled for deletion by means of the sillyrename
mechanism, it makes sense to start out writeback of the dirty data as
soon as possible in order to ensure that the delete can occur. Examples of
cases where this is an issue include "rm -rf", which will busy-wait until
the file is closed, and the sillyrename completes.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Trond Myklebust 18 年之前
父节点
当前提交
ccfeb50623
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      fs/nfs/dir.c

+ 2 - 0
fs/nfs/dir.c

@@ -1443,6 +1443,8 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry)
 	if (atomic_read(&dentry->d_count) > 1) {
 	if (atomic_read(&dentry->d_count) > 1) {
 		spin_unlock(&dentry->d_lock);
 		spin_unlock(&dentry->d_lock);
 		spin_unlock(&dcache_lock);
 		spin_unlock(&dcache_lock);
+		/* Start asynchronous writeout of the inode */
+		write_inode_now(dentry->d_inode, 0);
 		error = nfs_sillyrename(dir, dentry);
 		error = nfs_sillyrename(dir, dentry);
 		unlock_kernel();
 		unlock_kernel();
 		return error;
 		return error;