aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/dir.c8
-rw-r--r--fs/cifs/fcntl.c4
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/cifs/inode.c16
-rw-r--r--fs/cifs/link.c16
-rw-r--r--fs/cifs/readdir.c4
-rw-r--r--fs/cifs/xattr.c16
-rw-r--r--fs/namei.c12
-rw-r--r--fs/super.c2
-rw-r--r--include/linux/fs.h2
10 files changed, 42 insertions, 42 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index fed55e3c53df..632561dd9c50 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -138,9 +138,9 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
138 cifs_sb = CIFS_SB(inode->i_sb); 138 cifs_sb = CIFS_SB(inode->i_sb);
139 pTcon = cifs_sb->tcon; 139 pTcon = cifs_sb->tcon;
140 140
141 down(&direntry->d_sb->s_vfs_rename_sem); 141 mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
142 full_path = build_path_from_dentry(direntry); 142 full_path = build_path_from_dentry(direntry);
143 up(&direntry->d_sb->s_vfs_rename_sem); 143 mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
144 if(full_path == NULL) { 144 if(full_path == NULL) {
145 FreeXid(xid); 145 FreeXid(xid);
146 return -ENOMEM; 146 return -ENOMEM;
@@ -317,9 +317,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
317 cifs_sb = CIFS_SB(inode->i_sb); 317 cifs_sb = CIFS_SB(inode->i_sb);
318 pTcon = cifs_sb->tcon; 318 pTcon = cifs_sb->tcon;
319 319
320 down(&direntry->d_sb->s_vfs_rename_sem); 320 mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
321 full_path = build_path_from_dentry(direntry); 321 full_path = build_path_from_dentry(direntry);
322 up(&direntry->d_sb->s_vfs_rename_sem); 322 mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
323 if(full_path == NULL) 323 if(full_path == NULL)
324 rc = -ENOMEM; 324 rc = -ENOMEM;
325 else if (pTcon->ses->capabilities & CAP_UNIX) { 325 else if (pTcon->ses->capabilities & CAP_UNIX) {
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c
index a7a47bb36bf3..ec4dfe9bf5ef 100644
--- a/fs/cifs/fcntl.c
+++ b/fs/cifs/fcntl.c
@@ -86,9 +86,9 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
86 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 86 cifs_sb = CIFS_SB(file->f_dentry->d_sb);
87 pTcon = cifs_sb->tcon; 87 pTcon = cifs_sb->tcon;
88 88
89 down(&file->f_dentry->d_sb->s_vfs_rename_sem); 89 mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
90 full_path = build_path_from_dentry(file->f_dentry); 90 full_path = build_path_from_dentry(file->f_dentry);
91 up(&file->f_dentry->d_sb->s_vfs_rename_sem); 91 mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
92 92
93 if(full_path == NULL) { 93 if(full_path == NULL) {
94 rc = -ENOMEM; 94 rc = -ENOMEM;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 675bd2568297..165d67426381 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -203,9 +203,9 @@ int cifs_open(struct inode *inode, struct file *file)
203 } 203 }
204 } 204 }
205 205
206 down(&inode->i_sb->s_vfs_rename_sem); 206 mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
207 full_path = build_path_from_dentry(file->f_dentry); 207 full_path = build_path_from_dentry(file->f_dentry);
208 up(&inode->i_sb->s_vfs_rename_sem); 208 mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
209 if (full_path == NULL) { 209 if (full_path == NULL) {
210 FreeXid(xid); 210 FreeXid(xid);
211 return -ENOMEM; 211 return -ENOMEM;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 59359911f481..ff93a9f81d1c 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -574,9 +574,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
574 574
575 /* Unlink can be called from rename so we can not grab the sem here 575 /* Unlink can be called from rename so we can not grab the sem here
576 since we deadlock otherwise */ 576 since we deadlock otherwise */
577/* down(&direntry->d_sb->s_vfs_rename_sem);*/ 577/* mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);*/
578 full_path = build_path_from_dentry(direntry); 578 full_path = build_path_from_dentry(direntry);
579/* up(&direntry->d_sb->s_vfs_rename_sem);*/ 579/* mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);*/
580 if (full_path == NULL) { 580 if (full_path == NULL) {
581 FreeXid(xid); 581 FreeXid(xid);
582 return -ENOMEM; 582 return -ENOMEM;
@@ -718,9 +718,9 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
718 cifs_sb = CIFS_SB(inode->i_sb); 718 cifs_sb = CIFS_SB(inode->i_sb);
719 pTcon = cifs_sb->tcon; 719 pTcon = cifs_sb->tcon;
720 720
721 down(&inode->i_sb->s_vfs_rename_sem); 721 mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
722 full_path = build_path_from_dentry(direntry); 722 full_path = build_path_from_dentry(direntry);
723 up(&inode->i_sb->s_vfs_rename_sem); 723 mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
724 if (full_path == NULL) { 724 if (full_path == NULL) {
725 FreeXid(xid); 725 FreeXid(xid);
726 return -ENOMEM; 726 return -ENOMEM;
@@ -803,9 +803,9 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
803 cifs_sb = CIFS_SB(inode->i_sb); 803 cifs_sb = CIFS_SB(inode->i_sb);
804 pTcon = cifs_sb->tcon; 804 pTcon = cifs_sb->tcon;
805 805
806 down(&inode->i_sb->s_vfs_rename_sem); 806 mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
807 full_path = build_path_from_dentry(direntry); 807 full_path = build_path_from_dentry(direntry);
808 up(&inode->i_sb->s_vfs_rename_sem); 808 mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
809 if (full_path == NULL) { 809 if (full_path == NULL) {
810 FreeXid(xid); 810 FreeXid(xid);
811 return -ENOMEM; 811 return -ENOMEM;
@@ -1137,9 +1137,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1137 rc = 0; 1137 rc = 0;
1138 } 1138 }
1139 1139
1140 down(&direntry->d_sb->s_vfs_rename_sem); 1140 mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
1141 full_path = build_path_from_dentry(direntry); 1141 full_path = build_path_from_dentry(direntry);
1142 up(&direntry->d_sb->s_vfs_rename_sem); 1142 mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
1143 if (full_path == NULL) { 1143 if (full_path == NULL) {
1144 FreeXid(xid); 1144 FreeXid(xid);
1145 return -ENOMEM; 1145 return -ENOMEM;
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 0f99aae33162..8d0da7c87c7b 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -48,10 +48,10 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
48/* No need to check for cross device links since server will do that 48/* No need to check for cross device links since server will do that
49 BB note DFS case in future though (when we may have to check) */ 49 BB note DFS case in future though (when we may have to check) */
50 50
51 down(&inode->i_sb->s_vfs_rename_sem); 51 mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
52 fromName = build_path_from_dentry(old_file); 52 fromName = build_path_from_dentry(old_file);
53 toName = build_path_from_dentry(direntry); 53 toName = build_path_from_dentry(direntry);
54 up(&inode->i_sb->s_vfs_rename_sem); 54 mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
55 if((fromName == NULL) || (toName == NULL)) { 55 if((fromName == NULL) || (toName == NULL)) {
56 rc = -ENOMEM; 56 rc = -ENOMEM;
57 goto cifs_hl_exit; 57 goto cifs_hl_exit;
@@ -103,9 +103,9 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
103 103
104 xid = GetXid(); 104 xid = GetXid();
105 105
106 down(&direntry->d_sb->s_vfs_rename_sem); 106 mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
107 full_path = build_path_from_dentry(direntry); 107 full_path = build_path_from_dentry(direntry);
108 up(&direntry->d_sb->s_vfs_rename_sem); 108 mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
109 109
110 if (!full_path) 110 if (!full_path)
111 goto out_no_free; 111 goto out_no_free;
@@ -164,9 +164,9 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
164 cifs_sb = CIFS_SB(inode->i_sb); 164 cifs_sb = CIFS_SB(inode->i_sb);
165 pTcon = cifs_sb->tcon; 165 pTcon = cifs_sb->tcon;
166 166
167 down(&inode->i_sb->s_vfs_rename_sem); 167 mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
168 full_path = build_path_from_dentry(direntry); 168 full_path = build_path_from_dentry(direntry);
169 up(&inode->i_sb->s_vfs_rename_sem); 169 mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
170 170
171 if(full_path == NULL) { 171 if(full_path == NULL) {
172 FreeXid(xid); 172 FreeXid(xid);
@@ -232,9 +232,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
232 232
233/* BB would it be safe against deadlock to grab this sem 233/* BB would it be safe against deadlock to grab this sem
234 even though rename itself grabs the sem and calls lookup? */ 234 even though rename itself grabs the sem and calls lookup? */
235/* down(&inode->i_sb->s_vfs_rename_sem);*/ 235/* mutex_lock(&inode->i_sb->s_vfs_rename_mutex);*/
236 full_path = build_path_from_dentry(direntry); 236 full_path = build_path_from_dentry(direntry);
237/* up(&inode->i_sb->s_vfs_rename_sem);*/ 237/* mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);*/
238 238
239 if(full_path == NULL) { 239 if(full_path == NULL) {
240 FreeXid(xid); 240 FreeXid(xid);
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 288cc048d37f..edb3b6eb34bc 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -404,9 +404,9 @@ static int initiate_cifs_search(const int xid, struct file *file)
404 if(pTcon == NULL) 404 if(pTcon == NULL)
405 return -EINVAL; 405 return -EINVAL;
406 406
407 down(&file->f_dentry->d_sb->s_vfs_rename_sem); 407 mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
408 full_path = build_path_from_dentry(file->f_dentry); 408 full_path = build_path_from_dentry(file->f_dentry);
409 up(&file->f_dentry->d_sb->s_vfs_rename_sem); 409 mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
410 410
411 if(full_path == NULL) { 411 if(full_path == NULL) {
412 return -ENOMEM; 412 return -ENOMEM;
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 777e3363c2a4..3938444d87b2 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -62,9 +62,9 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
62 cifs_sb = CIFS_SB(sb); 62 cifs_sb = CIFS_SB(sb);
63 pTcon = cifs_sb->tcon; 63 pTcon = cifs_sb->tcon;
64 64
65 down(&sb->s_vfs_rename_sem); 65 mutex_lock(&sb->s_vfs_rename_mutex);
66 full_path = build_path_from_dentry(direntry); 66 full_path = build_path_from_dentry(direntry);
67 up(&sb->s_vfs_rename_sem); 67 mutex_unlock(&sb->s_vfs_rename_mutex);
68 if(full_path == NULL) { 68 if(full_path == NULL) {
69 FreeXid(xid); 69 FreeXid(xid);
70 return -ENOMEM; 70 return -ENOMEM;
@@ -116,9 +116,9 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
116 cifs_sb = CIFS_SB(sb); 116 cifs_sb = CIFS_SB(sb);
117 pTcon = cifs_sb->tcon; 117 pTcon = cifs_sb->tcon;
118 118
119 down(&sb->s_vfs_rename_sem); 119 mutex_lock(&sb->s_vfs_rename_mutex);
120 full_path = build_path_from_dentry(direntry); 120 full_path = build_path_from_dentry(direntry);
121 up(&sb->s_vfs_rename_sem); 121 mutex_unlock(&sb->s_vfs_rename_mutex);
122 if(full_path == NULL) { 122 if(full_path == NULL) {
123 FreeXid(xid); 123 FreeXid(xid);
124 return -ENOMEM; 124 return -ENOMEM;
@@ -223,9 +223,9 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
223 cifs_sb = CIFS_SB(sb); 223 cifs_sb = CIFS_SB(sb);
224 pTcon = cifs_sb->tcon; 224 pTcon = cifs_sb->tcon;
225 225
226 down(&sb->s_vfs_rename_sem); 226 mutex_lock(&sb->s_vfs_rename_mutex);
227 full_path = build_path_from_dentry(direntry); 227 full_path = build_path_from_dentry(direntry);
228 up(&sb->s_vfs_rename_sem); 228 mutex_unlock(&sb->s_vfs_rename_mutex);
229 if(full_path == NULL) { 229 if(full_path == NULL) {
230 FreeXid(xid); 230 FreeXid(xid);
231 return -ENOMEM; 231 return -ENOMEM;
@@ -341,9 +341,9 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
341 cifs_sb = CIFS_SB(sb); 341 cifs_sb = CIFS_SB(sb);
342 pTcon = cifs_sb->tcon; 342 pTcon = cifs_sb->tcon;
343 343
344 down(&sb->s_vfs_rename_sem); 344 mutex_lock(&sb->s_vfs_rename_mutex);
345 full_path = build_path_from_dentry(direntry); 345 full_path = build_path_from_dentry(direntry);
346 up(&sb->s_vfs_rename_sem); 346 mutex_unlock(&sb->s_vfs_rename_mutex);
347 if(full_path == NULL) { 347 if(full_path == NULL) {
348 FreeXid(xid); 348 FreeXid(xid);
349 return -ENOMEM; 349 return -ENOMEM;
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.
diff --git a/fs/super.c b/fs/super.c
index 9cc6545dfa4c..425861cb1caa 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -76,7 +76,7 @@ static struct super_block *alloc_super(void)
76 down_write(&s->s_umount); 76 down_write(&s->s_umount);
77 s->s_count = S_BIAS; 77 s->s_count = S_BIAS;
78 atomic_set(&s->s_active, 1); 78 atomic_set(&s->s_active, 1);
79 sema_init(&s->s_vfs_rename_sem,1); 79 mutex_init(&s->s_vfs_rename_mutex);
80 mutex_init(&s->s_dquot.dqio_mutex); 80 mutex_init(&s->s_dquot.dqio_mutex);
81 mutex_init(&s->s_dquot.dqonoff_mutex); 81 mutex_init(&s->s_dquot.dqonoff_mutex);
82 init_rwsem(&s->s_dquot.dqptr_sem); 82 init_rwsem(&s->s_dquot.dqptr_sem);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9ed1f36b6d54..0f71ee730127 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -847,7 +847,7 @@ struct super_block {
847 * The next field is for VFS *only*. No filesystems have any business 847 * The next field is for VFS *only*. No filesystems have any business
848 * even looking at it. You had been warned. 848 * even looking at it. You had been warned.
849 */ 849 */
850 struct semaphore s_vfs_rename_sem; /* Kludge */ 850 struct mutex s_vfs_rename_mutex; /* Kludge */
851 851
852 /* Granuality of c/m/atime in ns. 852 /* Granuality of c/m/atime in ns.
853 Cannot be worse than a second */ 853 Cannot be worse than a second */