diff options
| -rw-r--r-- | fs/nfs/dir.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b5fae1953e9d..11d0c4cffffc 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
| @@ -1581,7 +1581,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1581 | 1581 | ||
| 1582 | /* | 1582 | /* |
| 1583 | * To prevent any new references to the target during the rename, | 1583 | * To prevent any new references to the target during the rename, |
| 1584 | * we unhash the dentry and free the inode in advance. | 1584 | * we unhash the dentry in advance. |
| 1585 | */ | 1585 | */ |
| 1586 | if (!d_unhashed(new_dentry)) { | 1586 | if (!d_unhashed(new_dentry)) { |
| 1587 | d_drop(new_dentry); | 1587 | d_drop(new_dentry); |
| @@ -1594,12 +1594,10 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
| 1594 | atomic_read(&new_dentry->d_count)); | 1594 | atomic_read(&new_dentry->d_count)); |
| 1595 | 1595 | ||
| 1596 | /* | 1596 | /* |
| 1597 | * First check whether the target is busy ... we can't | 1597 | * For non-directories, check whether the target is busy and if so, |
| 1598 | * safely do _any_ rename if the target is in use. | 1598 | * make a copy of the dentry and then do a silly-rename. If the |
| 1599 | * | 1599 | * silly-rename succeeds, the copied dentry is hashed and becomes |
| 1600 | * For files, make a copy of the dentry and then do a | 1600 | * the new target. |
| 1601 | * silly-rename. If the silly-rename succeeds, the | ||
| 1602 | * copied dentry is hashed and becomes the new target. | ||
| 1603 | */ | 1601 | */ |
| 1604 | if (new_inode && !S_ISDIR(new_inode->i_mode) && | 1602 | if (new_inode && !S_ISDIR(new_inode->i_mode) && |
| 1605 | atomic_read(&new_dentry->d_count) > 2) { | 1603 | atomic_read(&new_dentry->d_count) > 2) { |
