aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nbd.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-21 10:37:27 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-21 10:37:27 -0500
commit77835492ed489c0b870f82f4c50687bd267acc0a (patch)
treed80903ce1b8dd30aa44ccfc756616ad4d6c74d63 /drivers/block/nbd.c
parentaf37501c792107c2bde1524bdae38d9a247b841a (diff)
parent1de9e8e70f5acc441550ca75433563d91b269bbe (diff)
Merge commit 'v2.6.29-rc2' into perfcounters/core
Conflicts: include/linux/syscalls.h
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r--drivers/block/nbd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7bcc1d8bc967..34f80fa6fed1 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -406,6 +406,7 @@ static int nbd_do_it(struct nbd_device *lo)
406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); 406 ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
407 if (ret) { 407 if (ret) {
408 printk(KERN_ERR "nbd: sysfs_create_file failed!"); 408 printk(KERN_ERR "nbd: sysfs_create_file failed!");
409 lo->pid = 0;
409 return ret; 410 return ret;
410 } 411 }
411 412
@@ -413,6 +414,7 @@ static int nbd_do_it(struct nbd_device *lo)
413 nbd_end_request(req); 414 nbd_end_request(req);
414 415
415 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr); 416 sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
417 lo->pid = 0;
416 return 0; 418 return 0;
417} 419}
418 420
@@ -648,6 +650,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
648 set_capacity(lo->disk, lo->bytesize >> 9); 650 set_capacity(lo->disk, lo->bytesize >> 9);
649 return 0; 651 return 0;
650 case NBD_DO_IT: 652 case NBD_DO_IT:
653 if (lo->pid)
654 return -EBUSY;
651 if (!lo->file) 655 if (!lo->file)
652 return -EINVAL; 656 return -EINVAL;
653 thread = kthread_create(nbd_thread, lo, lo->disk->disk_name); 657 thread = kthread_create(nbd_thread, lo, lo->disk->disk_name);