Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23056
b: refs/heads/master
c: 82d4dc5
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Mar 23, 2006
1 parent bbe8387 commit 40c0c44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f85221dd74f2708b78a2aa54de59944e44206d0e
refs/heads/master: 82d4dc5adb0055393248ad4ab8de392fac708a12
16 changes: 8 additions & 8 deletions trunk/drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ static void do_nbd_request(request_queue_t * q)
req->errors = 0;
spin_unlock_irq(q->queue_lock);

down(&lo->tx_lock);
mutex_lock(&lo->tx_lock);
if (unlikely(!lo->sock)) {
up(&lo->tx_lock);
mutex_unlock(&lo->tx_lock);
printk(KERN_ERR "%s: Attempted send on closed socket\n",
lo->disk->disk_name);
req->errors++;
Expand All @@ -484,7 +484,7 @@ static void do_nbd_request(request_queue_t * q)
}

lo->active_req = NULL;
up(&lo->tx_lock);
mutex_unlock(&lo->tx_lock);
wake_up_all(&lo->active_wq);

spin_lock_irq(q->queue_lock);
Expand Down Expand Up @@ -534,9 +534,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file,

case NBD_CLEAR_SOCK:
error = 0;
down(&lo->tx_lock);
mutex_lock(&lo->tx_lock);
lo->sock = NULL;
up(&lo->tx_lock);
mutex_unlock(&lo->tx_lock);
file = lo->file;
lo->file = NULL;
nbd_clear_que(lo);
Expand Down Expand Up @@ -590,15 +590,15 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
* FIXME: This code is duplicated from sys_shutdown, but
* there should be a more generic interface rather than
* calling socket ops directly here */
down(&lo->tx_lock);
mutex_lock(&lo->tx_lock);
if (lo->sock) {
printk(KERN_WARNING "%s: shutting down socket\n",
lo->disk->disk_name);
lo->sock->ops->shutdown(lo->sock,
SEND_SHUTDOWN|RCV_SHUTDOWN);
lo->sock = NULL;
}
up(&lo->tx_lock);
mutex_unlock(&lo->tx_lock);
file = lo->file;
lo->file = NULL;
nbd_clear_que(lo);
Expand Down Expand Up @@ -683,7 +683,7 @@ static int __init nbd_init(void)
nbd_dev[i].flags = 0;
spin_lock_init(&nbd_dev[i].queue_lock);
INIT_LIST_HEAD(&nbd_dev[i].queue_head);
init_MUTEX(&nbd_dev[i].tx_lock);
mutex_init(&nbd_dev[i].tx_lock);
init_waitqueue_head(&nbd_dev[i].active_wq);
nbd_dev[i].blksize = 1024;
nbd_dev[i].bytesize = 0x7ffffc00ULL << 10; /* 2TB */
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/linux/nbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ enum {
#ifdef __KERNEL__

#include <linux/wait.h>
#include <linux/mutex.h>

/* values for flags field */
#define NBD_READ_ONLY 0x0001
Expand All @@ -57,7 +58,7 @@ struct nbd_device {
struct request *active_req;
wait_queue_head_t active_wq;

struct semaphore tx_lock;
struct mutex tx_lock;
struct gendisk *disk;
int blksize;
u64 bytesize;
Expand Down

0 comments on commit 40c0c44

Please sign in to comment.