diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c index 8dc2b038d5d9..c72b940797fc 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -104,7 +104,7 @@ | |||
104 | */ | 104 | */ |
105 | /* | 105 | /* |
106 | * [Sep 2001 AV] Single-semaphore locking scheme (kudos to David Holland) | 106 | * [Sep 2001 AV] Single-semaphore locking scheme (kudos to David Holland) |
107 | * implemented. Let's see if raised priority of ->s_vfs_rename_sem gives | 107 | * implemented. Let's see if raised priority of ->s_vfs_rename_mutex gives |
108 | * any extra contention... | 108 | * any extra contention... |
109 | */ | 109 | */ |
110 | 110 | ||
@@ -1422,7 +1422,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) | |||
1422 | return NULL; | 1422 | return NULL; |
1423 | } | 1423 | } |
1424 | 1424 | ||
1425 | down(&p1->d_inode->i_sb->s_vfs_rename_sem); | 1425 | mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex); |
1426 | 1426 | ||
1427 | for (p = p1; p->d_parent != p; p = p->d_parent) { | 1427 | for (p = p1; p->d_parent != p; p = p->d_parent) { |
1428 | if (p->d_parent == p2) { | 1428 | if (p->d_parent == p2) { |
@@ -1450,7 +1450,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2) | |||
1450 | mutex_unlock(&p1->d_inode->i_mutex); | 1450 | mutex_unlock(&p1->d_inode->i_mutex); |
1451 | if (p1 != p2) { | 1451 | if (p1 != p2) { |
1452 | mutex_unlock(&p2->d_inode->i_mutex); | 1452 | mutex_unlock(&p2->d_inode->i_mutex); |
1453 | up(&p1->d_inode->i_sb->s_vfs_rename_sem); | 1453 | mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex); |
1454 | } | 1454 | } |
1455 | } | 1455 | } |
1456 | 1456 | ||
@@ -2277,17 +2277,17 @@ asmlinkage long sys_link(const char __user *oldname, const char __user *newname) | |||
2277 | * a) we can get into loop creation. Check is done in is_subdir(). | 2277 | * a) we can get into loop creation. Check is done in is_subdir(). |
2278 | * b) race potential - two innocent renames can create a loop together. | 2278 | * b) race potential - two innocent renames can create a loop together. |
2279 | * That's where 4.4 screws up. Current fix: serialization on | 2279 | * That's where 4.4 screws up. Current fix: serialization on |
2280 | * sb->s_vfs_rename_sem. We might be more accurate, but that's another | 2280 | * sb->s_vfs_rename_mutex. We might be more accurate, but that's another |
2281 | * story. | 2281 | * story. |
2282 | * c) we have to lock _three_ objects - parents and victim (if it exists). | 2282 | * c) we have to lock _three_ objects - parents and victim (if it exists). |
2283 | * And that - after we got ->i_mutex on parents (until then we don't know | 2283 | * And that - after we got ->i_mutex on parents (until then we don't know |
2284 | * whether the target exists). Solution: try to be smart with locking | 2284 | * whether the target exists). Solution: try to be smart with locking |
2285 | * order for inodes. We rely on the fact that tree topology may change | 2285 | * order for inodes. We rely on the fact that tree topology may change |
2286 | * only under ->s_vfs_rename_sem _and_ that parent of the object we | 2286 | * only under ->s_vfs_rename_mutex _and_ that parent of the object we |
2287 | * move will be locked. Thus we can rank directories by the tree | 2287 | * move will be locked. Thus we can rank directories by the tree |
2288 | * (ancestors first) and rank all non-directories after them. | 2288 | * (ancestors first) and rank all non-directories after them. |
2289 | * That works since everybody except rename does "lock parent, lookup, | 2289 | * That works since everybody except rename does "lock parent, lookup, |
2290 | * lock child" and rename is under ->s_vfs_rename_sem. | 2290 | * lock child" and rename is under ->s_vfs_rename_mutex. |
2291 | * HOWEVER, it relies on the assumption that any object with ->lookup() | 2291 | * HOWEVER, it relies on the assumption that any object with ->lookup() |
2292 | * has no more than 1 dentry. If "hybrid" objects will ever appear, | 2292 | * has no more than 1 dentry. If "hybrid" objects will ever appear, |
2293 | * we'd better make sure that there's no link(2) for them. | 2293 | * we'd better make sure that there's no link(2) for them. |