patch-2.1.119 linux/drivers/block/nbd.c
Next file: linux/drivers/char/joystick.c
Previous file: linux/drivers/block/ide.c
Back to the patch index
Back to the overall index
- Lines: 75
- Date:
Thu Aug 27 11:52:04 1998
- Orig file:
v2.1.118/linux/drivers/block/nbd.c
- Orig date:
Wed Aug 26 11:37:35 1998
diff -u --recursive --new-file v2.1.118/linux/drivers/block/nbd.c linux/drivers/block/nbd.c
@@ -81,9 +81,18 @@
int result;
struct msghdr msg;
struct iovec iov;
+ unsigned long flags;
oldfs = get_fs();
set_fs(get_ds());
+
+ spin_lock_irqsave(¤t->sigmask_lock, flags);
+ oldset = current->blocked;
+ sigfillset(¤t->blocked);
+ recalc_sigpending(current);
+ spin_unlock_irqrestore(¤t->sigmask_lock, flags);
+
+
do {
sigset_t oldset;
@@ -98,22 +107,11 @@
msg.msg_namelen = 0;
msg.msg_flags = 0;
- spin_lock_irq(¤t->sigmask_lock);
- oldset = current->blocked;
- sigfillset(¤t->blocked);
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
-
if (send)
result = sock_sendmsg(sock, &msg, size);
else
result = sock_recvmsg(sock, &msg, size, 0);
- spin_lock_irq(¤t->sigmask_lock);
- current->blocked = oldset;
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
-
if (result <= 0) {
#ifdef PARANOIA
printk(KERN_ERR "NBD: %s - sock=%ld at buf=%ld, size=%d returned %d.\n",
@@ -124,6 +122,12 @@
size -= result;
buf += result;
} while (size > 0);
+
+ spin_lock_irqsave(¤t->sigmask_lock, flags);
+ current->blocked = oldset;
+ recalc_sigpending(current);
+ spin_unlock_irqrestore(¤t->sigmask_lock, flags);
+
set_fs(oldfs);
return result;
}
@@ -295,8 +299,6 @@
requests_in++;
#endif
req->errors = 0;
-
- nbd_send_req(lo->sock, req); /* Why does this block? */
CURRENT = CURRENT->next;
req->next = NULL;
if (lo->head == NULL) {
@@ -306,6 +308,10 @@
lo->head->next = req;
lo->head = req;
}
+
+ spin_unlock_irq(&io_request_lock);
+ nbd_send_req(lo->sock, req); /* Why does this block? */
+ spin_lock_irq(&io_request_lock);
continue;
error_out:
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov