Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 129676
b: refs/heads/master
c: c91192d
h: refs/heads/master
v: v3
  • Loading branch information
Pavel Machek authored and Linus Torvalds committed Jan 16, 2009
1 parent 833e4bb commit e9c7168
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1bcbf31337391a2f54ef6c1e8871c2de5944a7dc
refs/heads/master: c91192d66d6cea7878b8542c9d9f1873971aba92
4 changes: 4 additions & 0 deletions trunk/drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,15 @@ static int nbd_do_it(struct nbd_device *lo)
ret = sysfs_create_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
if (ret) {
printk(KERN_ERR "nbd: sysfs_create_file failed!");
lo->pid = 0;
return ret;
}

while ((req = nbd_read_stat(lo)) != NULL)
nbd_end_request(req);

sysfs_remove_file(&disk_to_dev(lo->disk)->kobj, &pid_attr.attr);
lo->pid = 0;
return 0;
}

Expand Down Expand Up @@ -648,6 +650,8 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
set_capacity(lo->disk, lo->bytesize >> 9);
return 0;
case NBD_DO_IT:
if (lo->pid)
return -EBUSY;
if (!lo->file)
return -EINVAL;
thread = kthread_create(nbd_thread, lo, lo->disk->disk_name);
Expand Down

0 comments on commit e9c7168

Please sign in to comment.