Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208287
b: refs/heads/master
c: fa1bd35
h: refs/heads/master
i:
  208285: c231797
  208283: ee70c9b
  208279: bd2a223
  208271: 67be290
  208255: 5a6b796
v: v3
  • Loading branch information
Daniel Stodden authored and Jens Axboe committed Aug 7, 2010
1 parent 392a840 commit ddd5afe
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7fd152f4b6ae4f3cf89e4b7a0383cc3c470772fc
refs/heads/master: fa1bd3591a669b92b635dbdb11d1a32a5630821b
41 changes: 35 additions & 6 deletions trunk/drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,18 +1093,47 @@ static void blkback_changed(struct xenbus_device *dev,
}
}

static int blkfront_remove(struct xenbus_device *dev)
static int blkfront_remove(struct xenbus_device *xbdev)
{
struct blkfront_info *info = dev_get_drvdata(&dev->dev);
struct blkfront_info *info = dev_get_drvdata(&xbdev->dev);
struct block_device *bdev = NULL;
struct gendisk *disk;

dev_dbg(&dev->dev, "blkfront_remove: %s removed\n", dev->nodename);
dev_dbg(&xbdev->dev, "%s removed", xbdev->nodename);

blkif_free(info, 0);

if(info->users == 0)
mutex_lock(&info->mutex);

disk = info->gd;
if (disk)
bdev = bdget_disk(disk, 0);

info->xbdev = NULL;
mutex_unlock(&info->mutex);

if (!bdev) {
kfree(info);
return 0;
}

/*
* The xbdev was removed before we reached the Closed
* state. See if it's safe to remove the disk. If the bdev
* isn't closed yet, we let release take care of it.
*/

mutex_lock(&bdev->bd_mutex);
info = disk->private_data;

if (info && !info->users) {
xlvbd_release_gendisk(info);
disk->private_data = NULL;
kfree(info);
else
info->xbdev = NULL;
}

mutex_unlock(&bdev->bd_mutex);
bdput(bdev);

return 0;
}
Expand Down

0 comments on commit ddd5afe

Please sign in to comment.