diff options
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r-- | fs/nfs/dir.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 60da7550133c..68e0688904ea 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1297,14 +1297,12 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
1297 | dfprintk(VFS, "NFS: rmdir(%s/%ld), %s\n", | 1297 | dfprintk(VFS, "NFS: rmdir(%s/%ld), %s\n", |
1298 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); | 1298 | dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); |
1299 | 1299 | ||
1300 | lock_kernel(); | ||
1301 | error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); | 1300 | error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); |
1302 | /* Ensure the VFS deletes this inode */ | 1301 | /* Ensure the VFS deletes this inode */ |
1303 | if (error == 0 && dentry->d_inode != NULL) | 1302 | if (error == 0 && dentry->d_inode != NULL) |
1304 | clear_nlink(dentry->d_inode); | 1303 | clear_nlink(dentry->d_inode); |
1305 | else if (error == -ENOENT) | 1304 | else if (error == -ENOENT) |
1306 | nfs_dentry_handle_enoent(dentry); | 1305 | nfs_dentry_handle_enoent(dentry); |
1307 | unlock_kernel(); | ||
1308 | 1306 | ||
1309 | return error; | 1307 | return error; |
1310 | } | 1308 | } |
@@ -1429,7 +1427,6 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry) | |||
1429 | dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id, | 1427 | dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id, |
1430 | dir->i_ino, dentry->d_name.name); | 1428 | dir->i_ino, dentry->d_name.name); |
1431 | 1429 | ||
1432 | lock_kernel(); | ||
1433 | spin_lock(&dcache_lock); | 1430 | spin_lock(&dcache_lock); |
1434 | spin_lock(&dentry->d_lock); | 1431 | spin_lock(&dentry->d_lock); |
1435 | if (atomic_read(&dentry->d_count) > 1) { | 1432 | if (atomic_read(&dentry->d_count) > 1) { |
@@ -1437,6 +1434,7 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry) | |||
1437 | spin_unlock(&dcache_lock); | 1434 | spin_unlock(&dcache_lock); |
1438 | /* Start asynchronous writeout of the inode */ | 1435 | /* Start asynchronous writeout of the inode */ |
1439 | write_inode_now(dentry->d_inode, 0); | 1436 | write_inode_now(dentry->d_inode, 0); |
1437 | lock_kernel(); | ||
1440 | error = nfs_sillyrename(dir, dentry); | 1438 | error = nfs_sillyrename(dir, dentry); |
1441 | unlock_kernel(); | 1439 | unlock_kernel(); |
1442 | return error; | 1440 | return error; |
@@ -1452,7 +1450,6 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry) | |||
1452 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | 1450 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); |
1453 | } else if (need_rehash) | 1451 | } else if (need_rehash) |
1454 | d_rehash(dentry); | 1452 | d_rehash(dentry); |
1455 | unlock_kernel(); | ||
1456 | return error; | 1453 | return error; |
1457 | } | 1454 | } |
1458 | 1455 | ||
@@ -1587,7 +1584,6 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1587 | * To prevent any new references to the target during the rename, | 1584 | * To prevent any new references to the target during the rename, |
1588 | * we unhash the dentry and free the inode in advance. | 1585 | * we unhash the dentry and free the inode in advance. |
1589 | */ | 1586 | */ |
1590 | lock_kernel(); | ||
1591 | if (!d_unhashed(new_dentry)) { | 1587 | if (!d_unhashed(new_dentry)) { |
1592 | d_drop(new_dentry); | 1588 | d_drop(new_dentry); |
1593 | rehash = new_dentry; | 1589 | rehash = new_dentry; |
@@ -1621,7 +1617,9 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1621 | goto out; | 1617 | goto out; |
1622 | 1618 | ||
1623 | /* silly-rename the existing target ... */ | 1619 | /* silly-rename the existing target ... */ |
1620 | lock_kernel(); | ||
1624 | err = nfs_sillyrename(new_dir, new_dentry); | 1621 | err = nfs_sillyrename(new_dir, new_dentry); |
1622 | unlock_kernel(); | ||
1625 | if (!err) { | 1623 | if (!err) { |
1626 | new_dentry = rehash = dentry; | 1624 | new_dentry = rehash = dentry; |
1627 | new_inode = NULL; | 1625 | new_inode = NULL; |
@@ -1665,7 +1663,6 @@ out: | |||
1665 | /* new dentry created? */ | 1663 | /* new dentry created? */ |
1666 | if (dentry) | 1664 | if (dentry) |
1667 | dput(dentry); | 1665 | dput(dentry); |
1668 | unlock_kernel(); | ||
1669 | return error; | 1666 | return error; |
1670 | } | 1667 | } |
1671 | 1668 | ||