diff options
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r-- | drivers/block/xen-blkfront.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 715de7d8ce01..9c5a25a462e6 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -1168,9 +1168,6 @@ static int blkif_open(struct block_device *bdev, fmode_t mode) | |||
1168 | 1168 | ||
1169 | mutex_unlock(&info->mutex); | 1169 | mutex_unlock(&info->mutex); |
1170 | 1170 | ||
1171 | if (!err) | ||
1172 | ++info->users; | ||
1173 | |||
1174 | out: | 1171 | out: |
1175 | unlock_kernel(); | 1172 | unlock_kernel(); |
1176 | return err; | 1173 | return err; |
@@ -1183,12 +1180,13 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1183 | struct xenbus_device *xbdev; | 1180 | struct xenbus_device *xbdev; |
1184 | 1181 | ||
1185 | lock_kernel(); | 1182 | lock_kernel(); |
1186 | if (--info->users) | ||
1187 | goto out; | ||
1188 | 1183 | ||
1189 | bdev = bdget_disk(disk, 0); | 1184 | bdev = bdget_disk(disk, 0); |
1190 | bdput(bdev); | 1185 | bdput(bdev); |
1191 | 1186 | ||
1187 | if (bdev->bd_openers) | ||
1188 | goto out; | ||
1189 | |||
1192 | /* | 1190 | /* |
1193 | * Check if we have been instructed to close. We will have | 1191 | * Check if we have been instructed to close. We will have |
1194 | * deferred this request, because the bdev was still open. | 1192 | * deferred this request, because the bdev was still open. |
@@ -1212,7 +1210,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1212 | kfree(info); | 1210 | kfree(info); |
1213 | } | 1211 | } |
1214 | 1212 | ||
1215 | out: | ||
1216 | unlock_kernel(); | 1213 | unlock_kernel(); |
1217 | return 0; | 1214 | return 0; |
1218 | } | 1215 | } |