aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-04-21 14:54:46 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-04-21 14:54:46 -0400
commitd4dc210f69bcb0b4bef5a83b1c323817be89bad1 (patch)
tree58774a27fa6faff1260a416a86d2c121f0013431 /fs
parent1196f8b814f32cd04df334abf47648c2a9fd8324 (diff)
block: don't block events on excl write for non-optical devices
Disk event code automatically blocks events on excl write. This is primarily to avoid issuing polling commands while burning is in progress. This behavior doesn't fit other types of devices with removeable media where polling commands don't have adverse side effects and door locking usually doesn't exist. This patch introduces new genhd flag which controls the auto-blocking behavior and uses it to enable auto-blocking only on optical devices. Note for stable: 2.6.38 and later only Cc: stable@kernel.org Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 257b00e98428..d7c2e0fddc6f 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1237,6 +1237,8 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
1237 res = __blkdev_get(bdev, mode, 0); 1237 res = __blkdev_get(bdev, mode, 0);
1238 1238
1239 if (whole) { 1239 if (whole) {
1240 struct gendisk *disk = whole->bd_disk;
1241
1240 /* finish claiming */ 1242 /* finish claiming */
1241 mutex_lock(&bdev->bd_mutex); 1243 mutex_lock(&bdev->bd_mutex);
1242 spin_lock(&bdev_lock); 1244 spin_lock(&bdev_lock);
@@ -1263,15 +1265,16 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
1263 spin_unlock(&bdev_lock); 1265 spin_unlock(&bdev_lock);
1264 1266
1265 /* 1267 /*
1266 * Block event polling for write claims. Any write 1268 * Block event polling for write claims if requested. Any
1267 * holder makes the write_holder state stick until all 1269 * write holder makes the write_holder state stick until
1268 * are released. This is good enough and tracking 1270 * all are released. This is good enough and tracking
1269 * individual writeable reference is too fragile given 1271 * individual writeable reference is too fragile given the
1270 * the way @mode is used in blkdev_get/put(). 1272 * way @mode is used in blkdev_get/put().
1271 */ 1273 */
1272 if (!res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) { 1274 if ((disk->flags & GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE) &&
1275 !res && (mode & FMODE_WRITE) && !bdev->bd_write_holder) {
1273 bdev->bd_write_holder = true; 1276 bdev->bd_write_holder = true;
1274 disk_block_events(bdev->bd_disk); 1277 disk_block_events(disk);
1275 } 1278 }
1276 1279
1277 mutex_unlock(&bdev->bd_mutex); 1280 mutex_unlock(&bdev->bd_mutex);