diff options
author | Jes Sorensen <jes@sgi.com> | 2006-01-09 18:59:24 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@hera.kernel.org> | 2006-01-09 18:59:24 -0500 |
commit | 1b1dcc1b57a49136f118a0f16367256ff9994a69 (patch) | |
tree | b0b36d4f41d28c9d6514fb309d33c1a084d6309b /net/sunrpc/rpc_pipe.c | |
parent | 794ee1baee1c26be40410233e6c20bceb2b03c08 (diff) |
[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem
This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.
Modified-by: Ingo Molnar <mingo@elte.hu>
(finished the conversion)
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index e14c1cae7460..9764c80ab0b2 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -69,13 +69,13 @@ rpc_timeout_upcall_queue(void *data) | |||
69 | struct rpc_inode *rpci = (struct rpc_inode *)data; | 69 | struct rpc_inode *rpci = (struct rpc_inode *)data; |
70 | struct inode *inode = &rpci->vfs_inode; | 70 | struct inode *inode = &rpci->vfs_inode; |
71 | 71 | ||
72 | down(&inode->i_sem); | 72 | mutex_lock(&inode->i_mutex); |
73 | if (rpci->ops == NULL) | 73 | if (rpci->ops == NULL) |
74 | goto out; | 74 | goto out; |
75 | if (rpci->nreaders == 0 && !list_empty(&rpci->pipe)) | 75 | if (rpci->nreaders == 0 && !list_empty(&rpci->pipe)) |
76 | __rpc_purge_upcall(inode, -ETIMEDOUT); | 76 | __rpc_purge_upcall(inode, -ETIMEDOUT); |
77 | out: | 77 | out: |
78 | up(&inode->i_sem); | 78 | mutex_unlock(&inode->i_mutex); |
79 | } | 79 | } |
80 | 80 | ||
81 | int | 81 | int |
@@ -84,7 +84,7 @@ rpc_queue_upcall(struct inode *inode, struct rpc_pipe_msg *msg) | |||
84 | struct rpc_inode *rpci = RPC_I(inode); | 84 | struct rpc_inode *rpci = RPC_I(inode); |
85 | int res = -EPIPE; | 85 | int res = -EPIPE; |
86 | 86 | ||
87 | down(&inode->i_sem); | 87 | mutex_lock(&inode->i_mutex); |
88 | if (rpci->ops == NULL) | 88 | if (rpci->ops == NULL) |
89 | goto out; | 89 | goto out; |
90 | if (rpci->nreaders) { | 90 | if (rpci->nreaders) { |
@@ -100,7 +100,7 @@ rpc_queue_upcall(struct inode *inode, struct rpc_pipe_msg *msg) | |||
100 | res = 0; | 100 | res = 0; |
101 | } | 101 | } |
102 | out: | 102 | out: |
103 | up(&inode->i_sem); | 103 | mutex_unlock(&inode->i_mutex); |
104 | wake_up(&rpci->waitq); | 104 | wake_up(&rpci->waitq); |
105 | return res; | 105 | return res; |
106 | } | 106 | } |
@@ -116,7 +116,7 @@ rpc_close_pipes(struct inode *inode) | |||
116 | { | 116 | { |
117 | struct rpc_inode *rpci = RPC_I(inode); | 117 | struct rpc_inode *rpci = RPC_I(inode); |
118 | 118 | ||
119 | down(&inode->i_sem); | 119 | mutex_lock(&inode->i_mutex); |
120 | if (rpci->ops != NULL) { | 120 | if (rpci->ops != NULL) { |
121 | rpci->nreaders = 0; | 121 | rpci->nreaders = 0; |
122 | __rpc_purge_list(rpci, &rpci->in_upcall, -EPIPE); | 122 | __rpc_purge_list(rpci, &rpci->in_upcall, -EPIPE); |
@@ -127,7 +127,7 @@ rpc_close_pipes(struct inode *inode) | |||
127 | rpci->ops = NULL; | 127 | rpci->ops = NULL; |
128 | } | 128 | } |
129 | rpc_inode_setowner(inode, NULL); | 129 | rpc_inode_setowner(inode, NULL); |
130 | up(&inode->i_sem); | 130 | mutex_unlock(&inode->i_mutex); |
131 | cancel_delayed_work(&rpci->queue_timeout); | 131 | cancel_delayed_work(&rpci->queue_timeout); |
132 | flush_scheduled_work(); | 132 | flush_scheduled_work(); |
133 | } | 133 | } |
@@ -154,7 +154,7 @@ rpc_pipe_open(struct inode *inode, struct file *filp) | |||
154 | struct rpc_inode *rpci = RPC_I(inode); | 154 | struct rpc_inode *rpci = RPC_I(inode); |
155 | int res = -ENXIO; | 155 | int res = -ENXIO; |
156 | 156 | ||
157 | down(&inode->i_sem); | 157 | mutex_lock(&inode->i_mutex); |
158 | if (rpci->ops != NULL) { | 158 | if (rpci->ops != NULL) { |
159 | if (filp->f_mode & FMODE_READ) | 159 | if (filp->f_mode & FMODE_READ) |
160 | rpci->nreaders ++; | 160 | rpci->nreaders ++; |
@@ -162,7 +162,7 @@ rpc_pipe_open(struct inode *inode, struct file *filp) | |||
162 | rpci->nwriters ++; | 162 | rpci->nwriters ++; |
163 | res = 0; | 163 | res = 0; |
164 | } | 164 | } |
165 | up(&inode->i_sem); | 165 | mutex_unlock(&inode->i_mutex); |
166 | return res; | 166 | return res; |
167 | } | 167 | } |
168 | 168 | ||
@@ -172,7 +172,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp) | |||
172 | struct rpc_inode *rpci = RPC_I(inode); | 172 | struct rpc_inode *rpci = RPC_I(inode); |
173 | struct rpc_pipe_msg *msg; | 173 | struct rpc_pipe_msg *msg; |
174 | 174 | ||
175 | down(&inode->i_sem); | 175 | mutex_lock(&inode->i_mutex); |
176 | if (rpci->ops == NULL) | 176 | if (rpci->ops == NULL) |
177 | goto out; | 177 | goto out; |
178 | msg = (struct rpc_pipe_msg *)filp->private_data; | 178 | msg = (struct rpc_pipe_msg *)filp->private_data; |
@@ -190,7 +190,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp) | |||
190 | if (rpci->ops->release_pipe) | 190 | if (rpci->ops->release_pipe) |
191 | rpci->ops->release_pipe(inode); | 191 | rpci->ops->release_pipe(inode); |
192 | out: | 192 | out: |
193 | up(&inode->i_sem); | 193 | mutex_unlock(&inode->i_mutex); |
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
@@ -202,7 +202,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset) | |||
202 | struct rpc_pipe_msg *msg; | 202 | struct rpc_pipe_msg *msg; |
203 | int res = 0; | 203 | int res = 0; |
204 | 204 | ||
205 | down(&inode->i_sem); | 205 | mutex_lock(&inode->i_mutex); |
206 | if (rpci->ops == NULL) { | 206 | if (rpci->ops == NULL) { |
207 | res = -EPIPE; | 207 | res = -EPIPE; |
208 | goto out_unlock; | 208 | goto out_unlock; |
@@ -229,7 +229,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset) | |||
229 | rpci->ops->destroy_msg(msg); | 229 | rpci->ops->destroy_msg(msg); |
230 | } | 230 | } |
231 | out_unlock: | 231 | out_unlock: |
232 | up(&inode->i_sem); | 232 | mutex_unlock(&inode->i_mutex); |
233 | return res; | 233 | return res; |
234 | } | 234 | } |
235 | 235 | ||
@@ -240,11 +240,11 @@ rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *of | |||
240 | struct rpc_inode *rpci = RPC_I(inode); | 240 | struct rpc_inode *rpci = RPC_I(inode); |
241 | int res; | 241 | int res; |
242 | 242 | ||
243 | down(&inode->i_sem); | 243 | mutex_lock(&inode->i_mutex); |
244 | res = -EPIPE; | 244 | res = -EPIPE; |
245 | if (rpci->ops != NULL) | 245 | if (rpci->ops != NULL) |
246 | res = rpci->ops->downcall(filp, buf, len); | 246 | res = rpci->ops->downcall(filp, buf, len); |
247 | up(&inode->i_sem); | 247 | mutex_unlock(&inode->i_mutex); |
248 | return res; | 248 | return res; |
249 | } | 249 | } |
250 | 250 | ||
@@ -322,7 +322,7 @@ rpc_info_open(struct inode *inode, struct file *file) | |||
322 | 322 | ||
323 | if (!ret) { | 323 | if (!ret) { |
324 | struct seq_file *m = file->private_data; | 324 | struct seq_file *m = file->private_data; |
325 | down(&inode->i_sem); | 325 | mutex_lock(&inode->i_mutex); |
326 | clnt = RPC_I(inode)->private; | 326 | clnt = RPC_I(inode)->private; |
327 | if (clnt) { | 327 | if (clnt) { |
328 | atomic_inc(&clnt->cl_users); | 328 | atomic_inc(&clnt->cl_users); |
@@ -331,7 +331,7 @@ rpc_info_open(struct inode *inode, struct file *file) | |||
331 | single_release(inode, file); | 331 | single_release(inode, file); |
332 | ret = -EINVAL; | 332 | ret = -EINVAL; |
333 | } | 333 | } |
334 | up(&inode->i_sem); | 334 | mutex_unlock(&inode->i_mutex); |
335 | } | 335 | } |
336 | return ret; | 336 | return ret; |
337 | } | 337 | } |
@@ -491,7 +491,7 @@ rpc_depopulate(struct dentry *parent) | |||
491 | struct dentry *dentry, *dvec[10]; | 491 | struct dentry *dentry, *dvec[10]; |
492 | int n = 0; | 492 | int n = 0; |
493 | 493 | ||
494 | down(&dir->i_sem); | 494 | mutex_lock(&dir->i_mutex); |
495 | repeat: | 495 | repeat: |
496 | spin_lock(&dcache_lock); | 496 | spin_lock(&dcache_lock); |
497 | list_for_each_safe(pos, next, &parent->d_subdirs) { | 497 | list_for_each_safe(pos, next, &parent->d_subdirs) { |
@@ -519,7 +519,7 @@ repeat: | |||
519 | } while (n); | 519 | } while (n); |
520 | goto repeat; | 520 | goto repeat; |
521 | } | 521 | } |
522 | up(&dir->i_sem); | 522 | mutex_unlock(&dir->i_mutex); |
523 | } | 523 | } |
524 | 524 | ||
525 | static int | 525 | static int |
@@ -532,7 +532,7 @@ rpc_populate(struct dentry *parent, | |||
532 | struct dentry *dentry; | 532 | struct dentry *dentry; |
533 | int mode, i; | 533 | int mode, i; |
534 | 534 | ||
535 | down(&dir->i_sem); | 535 | mutex_lock(&dir->i_mutex); |
536 | for (i = start; i < eof; i++) { | 536 | for (i = start; i < eof; i++) { |
537 | dentry = d_alloc_name(parent, files[i].name); | 537 | dentry = d_alloc_name(parent, files[i].name); |
538 | if (!dentry) | 538 | if (!dentry) |
@@ -552,10 +552,10 @@ rpc_populate(struct dentry *parent, | |||
552 | dir->i_nlink++; | 552 | dir->i_nlink++; |
553 | d_add(dentry, inode); | 553 | d_add(dentry, inode); |
554 | } | 554 | } |
555 | up(&dir->i_sem); | 555 | mutex_unlock(&dir->i_mutex); |
556 | return 0; | 556 | return 0; |
557 | out_bad: | 557 | out_bad: |
558 | up(&dir->i_sem); | 558 | mutex_unlock(&dir->i_mutex); |
559 | printk(KERN_WARNING "%s: %s failed to populate directory %s\n", | 559 | printk(KERN_WARNING "%s: %s failed to populate directory %s\n", |
560 | __FILE__, __FUNCTION__, parent->d_name.name); | 560 | __FILE__, __FUNCTION__, parent->d_name.name); |
561 | return -ENOMEM; | 561 | return -ENOMEM; |
@@ -609,7 +609,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd) | |||
609 | if ((error = rpc_lookup_parent(path, nd)) != 0) | 609 | if ((error = rpc_lookup_parent(path, nd)) != 0) |
610 | return ERR_PTR(error); | 610 | return ERR_PTR(error); |
611 | dir = nd->dentry->d_inode; | 611 | dir = nd->dentry->d_inode; |
612 | down(&dir->i_sem); | 612 | mutex_lock(&dir->i_mutex); |
613 | dentry = lookup_hash(nd); | 613 | dentry = lookup_hash(nd); |
614 | if (IS_ERR(dentry)) | 614 | if (IS_ERR(dentry)) |
615 | goto out_err; | 615 | goto out_err; |
@@ -620,7 +620,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd) | |||
620 | } | 620 | } |
621 | return dentry; | 621 | return dentry; |
622 | out_err: | 622 | out_err: |
623 | up(&dir->i_sem); | 623 | mutex_unlock(&dir->i_mutex); |
624 | rpc_release_path(nd); | 624 | rpc_release_path(nd); |
625 | return dentry; | 625 | return dentry; |
626 | } | 626 | } |
@@ -646,7 +646,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client) | |||
646 | if (error) | 646 | if (error) |
647 | goto err_depopulate; | 647 | goto err_depopulate; |
648 | out: | 648 | out: |
649 | up(&dir->i_sem); | 649 | mutex_unlock(&dir->i_mutex); |
650 | rpc_release_path(&nd); | 650 | rpc_release_path(&nd); |
651 | return dentry; | 651 | return dentry; |
652 | err_depopulate: | 652 | err_depopulate: |
@@ -671,7 +671,7 @@ rpc_rmdir(char *path) | |||
671 | if ((error = rpc_lookup_parent(path, &nd)) != 0) | 671 | if ((error = rpc_lookup_parent(path, &nd)) != 0) |
672 | return error; | 672 | return error; |
673 | dir = nd.dentry->d_inode; | 673 | dir = nd.dentry->d_inode; |
674 | down(&dir->i_sem); | 674 | mutex_lock(&dir->i_mutex); |
675 | dentry = lookup_hash(&nd); | 675 | dentry = lookup_hash(&nd); |
676 | if (IS_ERR(dentry)) { | 676 | if (IS_ERR(dentry)) { |
677 | error = PTR_ERR(dentry); | 677 | error = PTR_ERR(dentry); |
@@ -681,7 +681,7 @@ rpc_rmdir(char *path) | |||
681 | error = __rpc_rmdir(dir, dentry); | 681 | error = __rpc_rmdir(dir, dentry); |
682 | dput(dentry); | 682 | dput(dentry); |
683 | out_release: | 683 | out_release: |
684 | up(&dir->i_sem); | 684 | mutex_unlock(&dir->i_mutex); |
685 | rpc_release_path(&nd); | 685 | rpc_release_path(&nd); |
686 | return error; | 686 | return error; |
687 | } | 687 | } |
@@ -710,7 +710,7 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) | |||
710 | rpci->ops = ops; | 710 | rpci->ops = ops; |
711 | inode_dir_notify(dir, DN_CREATE); | 711 | inode_dir_notify(dir, DN_CREATE); |
712 | out: | 712 | out: |
713 | up(&dir->i_sem); | 713 | mutex_unlock(&dir->i_mutex); |
714 | rpc_release_path(&nd); | 714 | rpc_release_path(&nd); |
715 | return dentry; | 715 | return dentry; |
716 | err_dput: | 716 | err_dput: |
@@ -732,7 +732,7 @@ rpc_unlink(char *path) | |||
732 | if ((error = rpc_lookup_parent(path, &nd)) != 0) | 732 | if ((error = rpc_lookup_parent(path, &nd)) != 0) |
733 | return error; | 733 | return error; |
734 | dir = nd.dentry->d_inode; | 734 | dir = nd.dentry->d_inode; |
735 | down(&dir->i_sem); | 735 | mutex_lock(&dir->i_mutex); |
736 | dentry = lookup_hash(&nd); | 736 | dentry = lookup_hash(&nd); |
737 | if (IS_ERR(dentry)) { | 737 | if (IS_ERR(dentry)) { |
738 | error = PTR_ERR(dentry); | 738 | error = PTR_ERR(dentry); |
@@ -746,7 +746,7 @@ rpc_unlink(char *path) | |||
746 | dput(dentry); | 746 | dput(dentry); |
747 | inode_dir_notify(dir, DN_DELETE); | 747 | inode_dir_notify(dir, DN_DELETE); |
748 | out_release: | 748 | out_release: |
749 | up(&dir->i_sem); | 749 | mutex_unlock(&dir->i_mutex); |
750 | rpc_release_path(&nd); | 750 | rpc_release_path(&nd); |
751 | return error; | 751 | return error; |
752 | } | 752 | } |