diff options
-rw-r--r-- | fs/ncpfs/file.c | 4 | ||||
-rw-r--r-- | fs/ncpfs/inode.c | 6 | ||||
-rw-r--r-- | fs/ncpfs/ncplib_kernel.c | 4 | ||||
-rw-r--r-- | fs/ncpfs/sock.c | 34 | ||||
-rw-r--r-- | include/linux/ncp_fs_i.h | 2 | ||||
-rw-r--r-- | include/linux/ncp_fs_sb.h | 5 |
6 files changed, 28 insertions, 27 deletions
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 973b444d6914..ebdad8f6398f 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -46,7 +46,7 @@ int ncp_make_open(struct inode *inode, int right) | |||
46 | NCP_FINFO(inode)->volNumber, | 46 | NCP_FINFO(inode)->volNumber, |
47 | NCP_FINFO(inode)->dirEntNum); | 47 | NCP_FINFO(inode)->dirEntNum); |
48 | error = -EACCES; | 48 | error = -EACCES; |
49 | down(&NCP_FINFO(inode)->open_sem); | 49 | mutex_lock(&NCP_FINFO(inode)->open_mutex); |
50 | if (!atomic_read(&NCP_FINFO(inode)->opened)) { | 50 | if (!atomic_read(&NCP_FINFO(inode)->opened)) { |
51 | struct ncp_entry_info finfo; | 51 | struct ncp_entry_info finfo; |
52 | int result; | 52 | int result; |
@@ -93,7 +93,7 @@ int ncp_make_open(struct inode *inode, int right) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | out_unlock: | 95 | out_unlock: |
96 | up(&NCP_FINFO(inode)->open_sem); | 96 | mutex_unlock(&NCP_FINFO(inode)->open_mutex); |
97 | out: | 97 | out: |
98 | return error; | 98 | return error; |
99 | } | 99 | } |
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c index d277a58bd128..0b521d3d97ce 100644 --- a/fs/ncpfs/inode.c +++ b/fs/ncpfs/inode.c | |||
@@ -63,7 +63,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) | |||
63 | 63 | ||
64 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 64 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
65 | SLAB_CTOR_CONSTRUCTOR) { | 65 | SLAB_CTOR_CONSTRUCTOR) { |
66 | init_MUTEX(&ei->open_sem); | 66 | mutex_init(&ei->open_mutex); |
67 | inode_init_once(&ei->vfs_inode); | 67 | inode_init_once(&ei->vfs_inode); |
68 | } | 68 | } |
69 | } | 69 | } |
@@ -520,7 +520,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
520 | } | 520 | } |
521 | 521 | ||
522 | /* server->lock = 0; */ | 522 | /* server->lock = 0; */ |
523 | init_MUTEX(&server->sem); | 523 | mutex_init(&server->mutex); |
524 | server->packet = NULL; | 524 | server->packet = NULL; |
525 | /* server->buffer_size = 0; */ | 525 | /* server->buffer_size = 0; */ |
526 | /* server->conn_status = 0; */ | 526 | /* server->conn_status = 0; */ |
@@ -557,7 +557,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) | |||
557 | server->dentry_ttl = 0; /* no caching */ | 557 | server->dentry_ttl = 0; /* no caching */ |
558 | 558 | ||
559 | INIT_LIST_HEAD(&server->tx.requests); | 559 | INIT_LIST_HEAD(&server->tx.requests); |
560 | init_MUTEX(&server->rcv.creq_sem); | 560 | mutex_init(&server->rcv.creq_mutex); |
561 | server->tx.creq = NULL; | 561 | server->tx.creq = NULL; |
562 | server->rcv.creq = NULL; | 562 | server->rcv.creq = NULL; |
563 | server->data_ready = sock->sk->sk_data_ready; | 563 | server->data_ready = sock->sk->sk_data_ready; |
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c index c755e1848a42..d9ebf6439f59 100644 --- a/fs/ncpfs/ncplib_kernel.c +++ b/fs/ncpfs/ncplib_kernel.c | |||
@@ -291,7 +291,7 @@ ncp_make_closed(struct inode *inode) | |||
291 | int err; | 291 | int err; |
292 | 292 | ||
293 | err = 0; | 293 | err = 0; |
294 | down(&NCP_FINFO(inode)->open_sem); | 294 | mutex_lock(&NCP_FINFO(inode)->open_mutex); |
295 | if (atomic_read(&NCP_FINFO(inode)->opened) == 1) { | 295 | if (atomic_read(&NCP_FINFO(inode)->opened) == 1) { |
296 | atomic_set(&NCP_FINFO(inode)->opened, 0); | 296 | atomic_set(&NCP_FINFO(inode)->opened, 0); |
297 | err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle); | 297 | err = ncp_close_file(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle); |
@@ -301,7 +301,7 @@ ncp_make_closed(struct inode *inode) | |||
301 | NCP_FINFO(inode)->volNumber, | 301 | NCP_FINFO(inode)->volNumber, |
302 | NCP_FINFO(inode)->dirEntNum, err); | 302 | NCP_FINFO(inode)->dirEntNum, err); |
303 | } | 303 | } |
304 | up(&NCP_FINFO(inode)->open_sem); | 304 | mutex_unlock(&NCP_FINFO(inode)->open_mutex); |
305 | return err; | 305 | return err; |
306 | } | 306 | } |
307 | 307 | ||
diff --git a/fs/ncpfs/sock.c b/fs/ncpfs/sock.c index 6593a5ca88ba..8783eb7ec641 100644 --- a/fs/ncpfs/sock.c +++ b/fs/ncpfs/sock.c | |||
@@ -171,9 +171,9 @@ static inline void __ncp_abort_request(struct ncp_server *server, struct ncp_req | |||
171 | 171 | ||
172 | static inline void ncp_abort_request(struct ncp_server *server, struct ncp_request_reply *req, int err) | 172 | static inline void ncp_abort_request(struct ncp_server *server, struct ncp_request_reply *req, int err) |
173 | { | 173 | { |
174 | down(&server->rcv.creq_sem); | 174 | mutex_lock(&server->rcv.creq_mutex); |
175 | __ncp_abort_request(server, req, err); | 175 | __ncp_abort_request(server, req, err); |
176 | up(&server->rcv.creq_sem); | 176 | mutex_unlock(&server->rcv.creq_mutex); |
177 | } | 177 | } |
178 | 178 | ||
179 | static inline void __ncptcp_abort(struct ncp_server *server) | 179 | static inline void __ncptcp_abort(struct ncp_server *server) |
@@ -303,20 +303,20 @@ static inline void __ncp_start_request(struct ncp_server *server, struct ncp_req | |||
303 | 303 | ||
304 | static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply *req) | 304 | static int ncp_add_request(struct ncp_server *server, struct ncp_request_reply *req) |
305 | { | 305 | { |
306 | down(&server->rcv.creq_sem); | 306 | mutex_lock(&server->rcv.creq_mutex); |
307 | if (!ncp_conn_valid(server)) { | 307 | if (!ncp_conn_valid(server)) { |
308 | up(&server->rcv.creq_sem); | 308 | mutex_unlock(&server->rcv.creq_mutex); |
309 | printk(KERN_ERR "ncpfs: tcp: Server died\n"); | 309 | printk(KERN_ERR "ncpfs: tcp: Server died\n"); |
310 | return -EIO; | 310 | return -EIO; |
311 | } | 311 | } |
312 | if (server->tx.creq || server->rcv.creq) { | 312 | if (server->tx.creq || server->rcv.creq) { |
313 | req->status = RQ_QUEUED; | 313 | req->status = RQ_QUEUED; |
314 | list_add_tail(&req->req, &server->tx.requests); | 314 | list_add_tail(&req->req, &server->tx.requests); |
315 | up(&server->rcv.creq_sem); | 315 | mutex_unlock(&server->rcv.creq_mutex); |
316 | return 0; | 316 | return 0; |
317 | } | 317 | } |
318 | __ncp_start_request(server, req); | 318 | __ncp_start_request(server, req); |
319 | up(&server->rcv.creq_sem); | 319 | mutex_unlock(&server->rcv.creq_mutex); |
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
@@ -400,7 +400,7 @@ void ncpdgram_rcv_proc(void *s) | |||
400 | info_server(server, 0, server->unexpected_packet.data, result); | 400 | info_server(server, 0, server->unexpected_packet.data, result); |
401 | continue; | 401 | continue; |
402 | } | 402 | } |
403 | down(&server->rcv.creq_sem); | 403 | mutex_lock(&server->rcv.creq_mutex); |
404 | req = server->rcv.creq; | 404 | req = server->rcv.creq; |
405 | if (req && (req->tx_type == NCP_ALLOC_SLOT_REQUEST || (server->sequence == reply.sequence && | 405 | if (req && (req->tx_type == NCP_ALLOC_SLOT_REQUEST || (server->sequence == reply.sequence && |
406 | server->connection == get_conn_number(&reply)))) { | 406 | server->connection == get_conn_number(&reply)))) { |
@@ -430,11 +430,11 @@ void ncpdgram_rcv_proc(void *s) | |||
430 | server->rcv.creq = NULL; | 430 | server->rcv.creq = NULL; |
431 | ncp_finish_request(req, result); | 431 | ncp_finish_request(req, result); |
432 | __ncp_next_request(server); | 432 | __ncp_next_request(server); |
433 | up(&server->rcv.creq_sem); | 433 | mutex_unlock(&server->rcv.creq_mutex); |
434 | continue; | 434 | continue; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | up(&server->rcv.creq_sem); | 437 | mutex_unlock(&server->rcv.creq_mutex); |
438 | } | 438 | } |
439 | drop:; | 439 | drop:; |
440 | _recv(sock, &reply, sizeof(reply), MSG_DONTWAIT); | 440 | _recv(sock, &reply, sizeof(reply), MSG_DONTWAIT); |
@@ -472,9 +472,9 @@ static void __ncpdgram_timeout_proc(struct ncp_server *server) | |||
472 | void ncpdgram_timeout_proc(void *s) | 472 | void ncpdgram_timeout_proc(void *s) |
473 | { | 473 | { |
474 | struct ncp_server *server = s; | 474 | struct ncp_server *server = s; |
475 | down(&server->rcv.creq_sem); | 475 | mutex_lock(&server->rcv.creq_mutex); |
476 | __ncpdgram_timeout_proc(server); | 476 | __ncpdgram_timeout_proc(server); |
477 | up(&server->rcv.creq_sem); | 477 | mutex_unlock(&server->rcv.creq_mutex); |
478 | } | 478 | } |
479 | 479 | ||
480 | static inline void ncp_init_req(struct ncp_request_reply* req) | 480 | static inline void ncp_init_req(struct ncp_request_reply* req) |
@@ -657,18 +657,18 @@ void ncp_tcp_rcv_proc(void *s) | |||
657 | { | 657 | { |
658 | struct ncp_server *server = s; | 658 | struct ncp_server *server = s; |
659 | 659 | ||
660 | down(&server->rcv.creq_sem); | 660 | mutex_lock(&server->rcv.creq_mutex); |
661 | __ncptcp_rcv_proc(server); | 661 | __ncptcp_rcv_proc(server); |
662 | up(&server->rcv.creq_sem); | 662 | mutex_unlock(&server->rcv.creq_mutex); |
663 | } | 663 | } |
664 | 664 | ||
665 | void ncp_tcp_tx_proc(void *s) | 665 | void ncp_tcp_tx_proc(void *s) |
666 | { | 666 | { |
667 | struct ncp_server *server = s; | 667 | struct ncp_server *server = s; |
668 | 668 | ||
669 | down(&server->rcv.creq_sem); | 669 | mutex_lock(&server->rcv.creq_mutex); |
670 | __ncptcp_try_send(server); | 670 | __ncptcp_try_send(server); |
671 | up(&server->rcv.creq_sem); | 671 | mutex_unlock(&server->rcv.creq_mutex); |
672 | } | 672 | } |
673 | 673 | ||
674 | static int do_ncp_rpc_call(struct ncp_server *server, int size, | 674 | static int do_ncp_rpc_call(struct ncp_server *server, int size, |
@@ -833,7 +833,7 @@ int ncp_disconnect(struct ncp_server *server) | |||
833 | 833 | ||
834 | void ncp_lock_server(struct ncp_server *server) | 834 | void ncp_lock_server(struct ncp_server *server) |
835 | { | 835 | { |
836 | down(&server->sem); | 836 | mutex_lock(&server->mutex); |
837 | if (server->lock) | 837 | if (server->lock) |
838 | printk(KERN_WARNING "ncp_lock_server: was locked!\n"); | 838 | printk(KERN_WARNING "ncp_lock_server: was locked!\n"); |
839 | server->lock = 1; | 839 | server->lock = 1; |
@@ -846,5 +846,5 @@ void ncp_unlock_server(struct ncp_server *server) | |||
846 | return; | 846 | return; |
847 | } | 847 | } |
848 | server->lock = 0; | 848 | server->lock = 0; |
849 | up(&server->sem); | 849 | mutex_unlock(&server->mutex); |
850 | } | 850 | } |
diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h index 415be1ec6f98..bdb4c8ae6924 100644 --- a/include/linux/ncp_fs_i.h +++ b/include/linux/ncp_fs_i.h | |||
@@ -19,7 +19,7 @@ struct ncp_inode_info { | |||
19 | __le32 DosDirNum; | 19 | __le32 DosDirNum; |
20 | __u8 volNumber; | 20 | __u8 volNumber; |
21 | __le32 nwattr; | 21 | __le32 nwattr; |
22 | struct semaphore open_sem; | 22 | struct mutex open_mutex; |
23 | atomic_t opened; | 23 | atomic_t opened; |
24 | int access; | 24 | int access; |
25 | int flags; | 25 | int flags; |
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h index cf858eb80f0b..b089d9506283 100644 --- a/include/linux/ncp_fs_sb.h +++ b/include/linux/ncp_fs_sb.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/ncp_mount.h> | 12 | #include <linux/ncp_mount.h> |
13 | #include <linux/net.h> | 13 | #include <linux/net.h> |
14 | #include <linux/mutex.h> | ||
14 | 15 | ||
15 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
16 | 17 | ||
@@ -51,7 +52,7 @@ struct ncp_server { | |||
51 | receive replies */ | 52 | receive replies */ |
52 | 53 | ||
53 | int lock; /* To prevent mismatch in protocols. */ | 54 | int lock; /* To prevent mismatch in protocols. */ |
54 | struct semaphore sem; | 55 | struct mutex mutex; |
55 | 56 | ||
56 | int current_size; /* for packet preparation */ | 57 | int current_size; /* for packet preparation */ |
57 | int has_subfunction; | 58 | int has_subfunction; |
@@ -96,7 +97,7 @@ struct ncp_server { | |||
96 | struct { | 97 | struct { |
97 | struct work_struct tq; /* STREAM/DGRAM: data/error ready */ | 98 | struct work_struct tq; /* STREAM/DGRAM: data/error ready */ |
98 | struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */ | 99 | struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */ |
99 | struct semaphore creq_sem; /* DGRAM only: lock accesses to rcv.creq */ | 100 | struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */ |
100 | 101 | ||
101 | unsigned int state; /* STREAM only: receiver state */ | 102 | unsigned int state; /* STREAM only: receiver state */ |
102 | struct { | 103 | struct { |