diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
commit | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch) | |
tree | f5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /net/sunrpc | |
parent | ac58c9059da8886b5e8cde012a80266b18ca146e (diff) | |
parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) |
Merge branch 'linus'
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/cache.c | 17 | ||||
-rw-r--r-- | net/sunrpc/sched.c | 11 | ||||
-rw-r--r-- | net/sunrpc/svcsock.c | 8 |
3 files changed, 19 insertions, 17 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index dcaa0c4453ff..0acccfeeb284 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/proc_fs.h> | 26 | #include <linux/proc_fs.h> |
27 | #include <linux/net.h> | 27 | #include <linux/net.h> |
28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
29 | #include <linux/mutex.h> | ||
29 | #include <asm/ioctls.h> | 30 | #include <asm/ioctls.h> |
30 | #include <linux/sunrpc/types.h> | 31 | #include <linux/sunrpc/types.h> |
31 | #include <linux/sunrpc/cache.h> | 32 | #include <linux/sunrpc/cache.h> |
@@ -532,7 +533,7 @@ void cache_clean_deferred(void *owner) | |||
532 | */ | 533 | */ |
533 | 534 | ||
534 | static DEFINE_SPINLOCK(queue_lock); | 535 | static DEFINE_SPINLOCK(queue_lock); |
535 | static DECLARE_MUTEX(queue_io_sem); | 536 | static DEFINE_MUTEX(queue_io_mutex); |
536 | 537 | ||
537 | struct cache_queue { | 538 | struct cache_queue { |
538 | struct list_head list; | 539 | struct list_head list; |
@@ -561,7 +562,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
561 | if (count == 0) | 562 | if (count == 0) |
562 | return 0; | 563 | return 0; |
563 | 564 | ||
564 | down(&queue_io_sem); /* protect against multiple concurrent | 565 | mutex_lock(&queue_io_mutex); /* protect against multiple concurrent |
565 | * readers on this file */ | 566 | * readers on this file */ |
566 | again: | 567 | again: |
567 | spin_lock(&queue_lock); | 568 | spin_lock(&queue_lock); |
@@ -574,7 +575,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
574 | } | 575 | } |
575 | if (rp->q.list.next == &cd->queue) { | 576 | if (rp->q.list.next == &cd->queue) { |
576 | spin_unlock(&queue_lock); | 577 | spin_unlock(&queue_lock); |
577 | up(&queue_io_sem); | 578 | mutex_unlock(&queue_io_mutex); |
578 | BUG_ON(rp->offset); | 579 | BUG_ON(rp->offset); |
579 | return 0; | 580 | return 0; |
580 | } | 581 | } |
@@ -621,11 +622,11 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
621 | } | 622 | } |
622 | if (err == -EAGAIN) | 623 | if (err == -EAGAIN) |
623 | goto again; | 624 | goto again; |
624 | up(&queue_io_sem); | 625 | mutex_unlock(&queue_io_mutex); |
625 | return err ? err : count; | 626 | return err ? err : count; |
626 | } | 627 | } |
627 | 628 | ||
628 | static char write_buf[8192]; /* protected by queue_io_sem */ | 629 | static char write_buf[8192]; /* protected by queue_io_mutex */ |
629 | 630 | ||
630 | static ssize_t | 631 | static ssize_t |
631 | cache_write(struct file *filp, const char __user *buf, size_t count, | 632 | cache_write(struct file *filp, const char __user *buf, size_t count, |
@@ -639,10 +640,10 @@ cache_write(struct file *filp, const char __user *buf, size_t count, | |||
639 | if (count >= sizeof(write_buf)) | 640 | if (count >= sizeof(write_buf)) |
640 | return -EINVAL; | 641 | return -EINVAL; |
641 | 642 | ||
642 | down(&queue_io_sem); | 643 | mutex_lock(&queue_io_mutex); |
643 | 644 | ||
644 | if (copy_from_user(write_buf, buf, count)) { | 645 | if (copy_from_user(write_buf, buf, count)) { |
645 | up(&queue_io_sem); | 646 | mutex_unlock(&queue_io_mutex); |
646 | return -EFAULT; | 647 | return -EFAULT; |
647 | } | 648 | } |
648 | write_buf[count] = '\0'; | 649 | write_buf[count] = '\0'; |
@@ -651,7 +652,7 @@ cache_write(struct file *filp, const char __user *buf, size_t count, | |||
651 | else | 652 | else |
652 | err = -EINVAL; | 653 | err = -EINVAL; |
653 | 654 | ||
654 | up(&queue_io_sem); | 655 | mutex_unlock(&queue_io_mutex); |
655 | return err ? err : count; | 656 | return err ? err : count; |
656 | } | 657 | } |
657 | 658 | ||
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 3fc13bea302d..b9969b91a9f7 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <linux/mutex.h> | ||
21 | 22 | ||
22 | #include <linux/sunrpc/clnt.h> | 23 | #include <linux/sunrpc/clnt.h> |
23 | #include <linux/sunrpc/xprt.h> | 24 | #include <linux/sunrpc/xprt.h> |
@@ -62,7 +63,7 @@ static LIST_HEAD(all_tasks); | |||
62 | /* | 63 | /* |
63 | * rpciod-related stuff | 64 | * rpciod-related stuff |
64 | */ | 65 | */ |
65 | static DECLARE_MUTEX(rpciod_sema); | 66 | static DEFINE_MUTEX(rpciod_mutex); |
66 | static unsigned int rpciod_users; | 67 | static unsigned int rpciod_users; |
67 | struct workqueue_struct *rpciod_workqueue; | 68 | struct workqueue_struct *rpciod_workqueue; |
68 | 69 | ||
@@ -1055,7 +1056,7 @@ rpciod_up(void) | |||
1055 | struct workqueue_struct *wq; | 1056 | struct workqueue_struct *wq; |
1056 | int error = 0; | 1057 | int error = 0; |
1057 | 1058 | ||
1058 | down(&rpciod_sema); | 1059 | mutex_lock(&rpciod_mutex); |
1059 | dprintk("rpciod_up: users %d\n", rpciod_users); | 1060 | dprintk("rpciod_up: users %d\n", rpciod_users); |
1060 | rpciod_users++; | 1061 | rpciod_users++; |
1061 | if (rpciod_workqueue) | 1062 | if (rpciod_workqueue) |
@@ -1078,14 +1079,14 @@ rpciod_up(void) | |||
1078 | rpciod_workqueue = wq; | 1079 | rpciod_workqueue = wq; |
1079 | error = 0; | 1080 | error = 0; |
1080 | out: | 1081 | out: |
1081 | up(&rpciod_sema); | 1082 | mutex_unlock(&rpciod_mutex); |
1082 | return error; | 1083 | return error; |
1083 | } | 1084 | } |
1084 | 1085 | ||
1085 | void | 1086 | void |
1086 | rpciod_down(void) | 1087 | rpciod_down(void) |
1087 | { | 1088 | { |
1088 | down(&rpciod_sema); | 1089 | mutex_lock(&rpciod_mutex); |
1089 | dprintk("rpciod_down sema %d\n", rpciod_users); | 1090 | dprintk("rpciod_down sema %d\n", rpciod_users); |
1090 | if (rpciod_users) { | 1091 | if (rpciod_users) { |
1091 | if (--rpciod_users) | 1092 | if (--rpciod_users) |
@@ -1102,7 +1103,7 @@ rpciod_down(void) | |||
1102 | destroy_workqueue(rpciod_workqueue); | 1103 | destroy_workqueue(rpciod_workqueue); |
1103 | rpciod_workqueue = NULL; | 1104 | rpciod_workqueue = NULL; |
1104 | out: | 1105 | out: |
1105 | up(&rpciod_sema); | 1106 | mutex_unlock(&rpciod_mutex); |
1106 | } | 1107 | } |
1107 | 1108 | ||
1108 | #ifdef RPC_DEBUG | 1109 | #ifdef RPC_DEBUG |
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 50580620e897..a27905a0ad27 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c | |||
@@ -1296,13 +1296,13 @@ svc_send(struct svc_rqst *rqstp) | |||
1296 | xb->page_len + | 1296 | xb->page_len + |
1297 | xb->tail[0].iov_len; | 1297 | xb->tail[0].iov_len; |
1298 | 1298 | ||
1299 | /* Grab svsk->sk_sem to serialize outgoing data. */ | 1299 | /* Grab svsk->sk_mutex to serialize outgoing data. */ |
1300 | down(&svsk->sk_sem); | 1300 | mutex_lock(&svsk->sk_mutex); |
1301 | if (test_bit(SK_DEAD, &svsk->sk_flags)) | 1301 | if (test_bit(SK_DEAD, &svsk->sk_flags)) |
1302 | len = -ENOTCONN; | 1302 | len = -ENOTCONN; |
1303 | else | 1303 | else |
1304 | len = svsk->sk_sendto(rqstp); | 1304 | len = svsk->sk_sendto(rqstp); |
1305 | up(&svsk->sk_sem); | 1305 | mutex_unlock(&svsk->sk_mutex); |
1306 | svc_sock_release(rqstp); | 1306 | svc_sock_release(rqstp); |
1307 | 1307 | ||
1308 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) | 1308 | if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) |
@@ -1351,7 +1351,7 @@ svc_setup_socket(struct svc_serv *serv, struct socket *sock, | |||
1351 | svsk->sk_lastrecv = get_seconds(); | 1351 | svsk->sk_lastrecv = get_seconds(); |
1352 | INIT_LIST_HEAD(&svsk->sk_deferred); | 1352 | INIT_LIST_HEAD(&svsk->sk_deferred); |
1353 | INIT_LIST_HEAD(&svsk->sk_ready); | 1353 | INIT_LIST_HEAD(&svsk->sk_ready); |
1354 | sema_init(&svsk->sk_sem, 1); | 1354 | mutex_init(&svsk->sk_mutex); |
1355 | 1355 | ||
1356 | /* Initialize the socket */ | 1356 | /* Initialize the socket */ |
1357 | if (sock->type == SOCK_DGRAM) | 1357 | if (sock->type == SOCK_DGRAM) |