req->errors = 0;
spin_unlock_irq(q->queue_lock);
- mutex_lock(&lo->tx_lock);
+ down(&lo->tx_lock);
if (unlikely(!lo->sock)) {
- mutex_unlock(&lo->tx_lock);
+ up(&lo->tx_lock);
printk(KERN_ERR "%s: Attempted send on closed socket\n",
lo->disk->disk_name);
req->errors++;
}
lo->active_req = NULL;
- mutex_unlock(&lo->tx_lock);
+ up(&lo->tx_lock);
wake_up_all(&lo->active_wq);
spin_lock_irq(q->queue_lock);
case NBD_CLEAR_SOCK:
error = 0;
- mutex_lock(&lo->tx_lock);
+ down(&lo->tx_lock);
lo->sock = NULL;
- mutex_unlock(&lo->tx_lock);
+ up(&lo->tx_lock);
file = lo->file;
lo->file = NULL;
nbd_clear_que(lo);
* FIXME: This code is duplicated from sys_shutdown, but
* there should be a more generic interface rather than
* calling socket ops directly here */
- mutex_lock(&lo->tx_lock);
+ down(&lo->tx_lock);
if (lo->sock) {
printk(KERN_WARNING "%s: shutting down socket\n",
lo->disk->disk_name);
SEND_SHUTDOWN|RCV_SHUTDOWN);
lo->sock = NULL;
}
- mutex_unlock(&lo->tx_lock);
+ up(&lo->tx_lock);
file = lo->file;
lo->file = NULL;
nbd_clear_que(lo);
int err = -ENOMEM;
int i;
- BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
+ if (sizeof(struct nbd_request) != 28) {
+ printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" );
+ return -EIO;
+ }
if (nbds_max > MAX_NBD) {
printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD,
nbd_dev[i].flags = 0;
spin_lock_init(&nbd_dev[i].queue_lock);
INIT_LIST_HEAD(&nbd_dev[i].queue_head);
- mutex_init(&nbd_dev[i].tx_lock);
+ init_MUTEX(&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 */