git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
block: do not pass disk names as format strings
[pandora-kernel.git]
/
drivers
/
block
/
nbd.c
diff --git
a/drivers/block/nbd.c
b/drivers/block/nbd.c
index
c3f0ee1
..
4d62fe0
100644
(file)
--- a/
drivers/block/nbd.c
+++ b/
drivers/block/nbd.c
@@
-445,6
+445,14
@@
static void nbd_clear_que(struct nbd_device *lo)
req->errors++;
nbd_end_request(req);
}
req->errors++;
nbd_end_request(req);
}
+
+ while (!list_empty(&lo->waiting_queue)) {
+ req = list_entry(lo->waiting_queue.next, struct request,
+ queuelist);
+ list_del_init(&req->queuelist);
+ req->errors++;
+ nbd_end_request(req);
+ }
}
}
@@
-576,12
+584,20
@@
static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo,
struct request sreq;
dev_info(disk_to_dev(lo->disk), "NBD_DISCONNECT\n");
struct request sreq;
dev_info(disk_to_dev(lo->disk), "NBD_DISCONNECT\n");
+ if (!lo->sock)
+ return -EINVAL;
+ mutex_unlock(&lo->tx_lock);
+ fsync_bdev(bdev);
+ mutex_lock(&lo->tx_lock);
blk_rq_init(NULL, &sreq);
sreq.cmd_type = REQ_TYPE_SPECIAL;
nbd_cmd(&sreq) = NBD_CMD_DISC;
blk_rq_init(NULL, &sreq);
sreq.cmd_type = REQ_TYPE_SPECIAL;
nbd_cmd(&sreq) = NBD_CMD_DISC;
+
+ /* Check again after getting mutex back. */
if (!lo->sock)
return -EINVAL;
if (!lo->sock)
return -EINVAL;
+
nbd_send_req(lo, &sreq);
return 0;
}
nbd_send_req(lo, &sreq);
return 0;
}
@@
-594,6
+610,8
@@
static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo,
lo->file = NULL;
nbd_clear_que(lo);
BUG_ON(!list_empty(&lo->queue_head));
lo->file = NULL;
nbd_clear_que(lo);
BUG_ON(!list_empty(&lo->queue_head));
+ BUG_ON(!list_empty(&lo->waiting_queue));
+ kill_bdev(bdev);
if (file)
fput(file);
return 0;
if (file)
fput(file);
return 0;
@@
-657,7
+675,8
@@
static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo,
mutex_unlock(&lo->tx_lock);
mutex_unlock(&lo->tx_lock);
- thread = kthread_create(nbd_thread, lo, lo->disk->disk_name);
+ thread = kthread_create(nbd_thread, lo, "%s",
+ lo->disk->disk_name);
if (IS_ERR(thread)) {
mutex_lock(&lo->tx_lock);
return PTR_ERR(thread);
if (IS_ERR(thread)) {
mutex_lock(&lo->tx_lock);
return PTR_ERR(thread);
@@
-674,6
+693,7
@@
static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo,
lo->file = NULL;
nbd_clear_que(lo);
dev_warn(disk_to_dev(lo->disk), "queue cleared\n");
lo->file = NULL;
nbd_clear_que(lo);
dev_warn(disk_to_dev(lo->disk), "queue cleared\n");
+ kill_bdev(bdev);
if (file)
fput(file);
lo->bytesize = 0;
if (file)
fput(file);
lo->bytesize = 0;