From 60d2ad5f92ed8b8aab58f18a1808a2987fbd6c2e Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Thu, 30 May 2002 20:47:43 -0700 Subject: [PATCH] Fix deadlock in nbd Variant of a patch in 2.4 by Steven Whitehouse. --- include/linux/nbd.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux') diff --git a/include/linux/nbd.h b/include/linux/nbd.h index 556b847804ca..eae4f5bbb65a 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -20,6 +20,12 @@ #define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) #define NBD_DISCONNECT _IO( 0xab, 8 ) +enum { + NBD_CMD_READ = 0, + NBD_CMD_WRITE = 1, + NBD_CMD_DISC = 2 +}; + #ifdef MAJOR_NR #include @@ -33,6 +39,8 @@ extern int requests_in; extern int requests_out; #endif +#define nbd_cmd(req) ((req)->cmd[0]) + static void nbd_end_request(struct request *req) { @@ -68,6 +76,7 @@ struct nbd_device { struct socket * sock; struct file * file; /* If == NULL, device is not ready, yet */ int magic; /* FIXME: not if debugging is off */ + spinlock_t queue_lock; struct list_head queue_head; /* Requests are added here... */ struct semaphore tx_lock; }; -- cgit v1.2.3