diff options
author | Paul Mackerras <paulus@samba.org> | 2007-05-10 21:08:37 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-10 21:08:37 +1000 |
commit | 2ecf042ef530dd0943e41d84b6344f507941af3e (patch) | |
tree | 73100361dd74e3f80f14c7c81ba4675948983f44 /drivers/block/nbd.c | |
parent | 32a56ebb24f23da1bbaf24292acf85b6c04526ab (diff) | |
parent | de5603748af8bf7deac403e6ba92887f8d18e812 (diff) | |
download | kernel-crypto-2ecf042ef530dd0943e41d84b6344f507941af3e.tar.gz kernel-crypto-2ecf042ef530dd0943e41d84b6344f507941af3e.tar.xz kernel-crypto-2ecf042ef530dd0943e41d84b6344f507941af3e.zip |
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers/block/nbd.c')
-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 090796bef78..069ae39a9cd 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -366,20 +366,25 @@ static struct disk_attribute pid_attr = { .show = pid_show, }; -static void nbd_do_it(struct nbd_device *lo) +static int nbd_do_it(struct nbd_device *lo) { struct request *req; + int ret; BUG_ON(lo->magic != LO_MAGIC); lo->pid = current->pid; - sysfs_create_file(&lo->disk->kobj, &pid_attr.attr); + ret = sysfs_create_file(&lo->disk->kobj, &pid_attr.attr); + if (ret) { + printk(KERN_ERR "nbd: sysfs_create_file failed!"); + return ret; + } while ((req = nbd_read_stat(lo)) != NULL) nbd_end_request(req); sysfs_remove_file(&lo->disk->kobj, &pid_attr.attr); - return; + return 0; } static void nbd_clear_que(struct nbd_device *lo) @@ -569,7 +574,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file, case NBD_DO_IT: if (!lo->file) return -EINVAL; - nbd_do_it(lo); + error = nbd_do_it(lo); + if (error) + return error; /* on return tidy up in case we have a signal */ /* Forcibly shutdown the socket causing all listeners * to error |