diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/nbd.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 090796bef78f..069ae39a9cd9 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -366,20 +366,25 @@ static struct disk_attribute pid_attr = { | |||
366 | .show = pid_show, | 366 | .show = pid_show, |
367 | }; | 367 | }; |
368 | 368 | ||
369 | static void nbd_do_it(struct nbd_device *lo) | 369 | static int nbd_do_it(struct nbd_device *lo) |
370 | { | 370 | { |
371 | struct request *req; | 371 | struct request *req; |
372 | int ret; | ||
372 | 373 | ||
373 | BUG_ON(lo->magic != LO_MAGIC); | 374 | BUG_ON(lo->magic != LO_MAGIC); |
374 | 375 | ||
375 | lo->pid = current->pid; | 376 | lo->pid = current->pid; |
376 | sysfs_create_file(&lo->disk->kobj, &pid_attr.attr); | 377 | ret = sysfs_create_file(&lo->disk->kobj, &pid_attr.attr); |
378 | if (ret) { | ||
379 | printk(KERN_ERR "nbd: sysfs_create_file failed!"); | ||
380 | return ret; | ||
381 | } | ||
377 | 382 | ||
378 | while ((req = nbd_read_stat(lo)) != NULL) | 383 | while ((req = nbd_read_stat(lo)) != NULL) |
379 | nbd_end_request(req); | 384 | nbd_end_request(req); |
380 | 385 | ||
381 | sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr); | 386 | sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr); |
382 | return; | 387 | return 0; |
383 | } | 388 | } |
384 | 389 | ||
385 | static void nbd_clear_que(struct nbd_device *lo) | 390 | static void nbd_clear_que(struct nbd_device *lo) |
@@ -569,7 +574,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
569 | case NBD_DO_IT: | 574 | case NBD_DO_IT: |
570 | if (!lo->file) | 575 | if (!lo->file) |
571 | return -EINVAL; | 576 | return -EINVAL; |
572 | nbd_do_it(lo); | 577 | error = nbd_do_it(lo); |
578 | if (error) | ||
579 | return error; | ||
573 | /* on return tidy up in case we have a signal */ | 580 | /* on return tidy up in case we have a signal */ |
574 | /* Forcibly shutdown the socket causing all listeners | 581 | /* Forcibly shutdown the socket causing all listeners |
575 | * to error | 582 | * to error |