diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 20:06:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-04 20:06:58 -0400 |
commit | b4fdcb02f1e39c27058a885905bd0277370ba441 (patch) | |
tree | fd4cfd1994f21f44afe5e7904681fb5ac09f81b8 /fs/block_dev.c | |
parent | 044595d4e448305fbaec472eb7d22636d24e7d8c (diff) | |
parent | 6dd9ad7df2019b1e33a372a501907db293ebcd0d (diff) |
Merge branch 'for-3.2/core' of git://git.kernel.dk/linux-block
* 'for-3.2/core' of git://git.kernel.dk/linux-block: (29 commits)
block: don't call blk_drain_queue() if elevator is not up
blk-throttle: use queue_is_locked() instead of lockdep_is_held()
blk-throttle: Take blkcg->lock while traversing blkcg->policy_list
blk-throttle: Free up policy node associated with deleted rule
block: warn if tag is greater than real_max_depth.
block: make gendisk hold a reference to its queue
blk-flush: move the queue kick into
blk-flush: fix invalid BUG_ON in blk_insert_flush
block: Remove the control of complete cpu from bio.
block: fix a typo in the blk-cgroup.h file
block: initialize the bounce pool if high memory may be added later
block: fix request_queue lifetime handling by making blk_queue_cleanup() properly shutdown
block: drop @tsk from attempt_plug_merge() and explain sync rules
block: make get_request[_wait]() fail if queue is dead
block: reorganize throtl_get_tg() and blk_throtl_bio()
block: reorganize queue draining
block: drop unnecessary blk_get/put_queue() in scsi_cmd_ioctl() and blk_get_tg()
block: pass around REQ_* flags instead of broken down booleans during request alloc/free
block: move blk_throtl prototypes to block/blk.h
block: fix genhd refcounting in blkio_policy_parse_and_set()
...
Fix up trivial conflicts due to "mddev_t" -> "struct mddev" conversion
and making the request functions be of type "void" instead of "int" in
- drivers/md/{faulty.c,linear.c,md.c,md.h,multipath.c,raid0.c,raid1.c,raid10.c,raid5.c}
- drivers/staging/zram/zram_drv.c
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 95f786ec7f08..1c44b8d54504 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1085,6 +1085,7 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part); | |||
1085 | static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | 1085 | static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
1086 | { | 1086 | { |
1087 | struct gendisk *disk; | 1087 | struct gendisk *disk; |
1088 | struct module *owner; | ||
1088 | int ret; | 1089 | int ret; |
1089 | int partno; | 1090 | int partno; |
1090 | int perm = 0; | 1091 | int perm = 0; |
@@ -1110,6 +1111,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1110 | disk = get_gendisk(bdev->bd_dev, &partno); | 1111 | disk = get_gendisk(bdev->bd_dev, &partno); |
1111 | if (!disk) | 1112 | if (!disk) |
1112 | goto out; | 1113 | goto out; |
1114 | owner = disk->fops->owner; | ||
1113 | 1115 | ||
1114 | disk_block_events(disk); | 1116 | disk_block_events(disk); |
1115 | mutex_lock_nested(&bdev->bd_mutex, for_part); | 1117 | mutex_lock_nested(&bdev->bd_mutex, for_part); |
@@ -1137,8 +1139,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1137 | bdev->bd_disk = NULL; | 1139 | bdev->bd_disk = NULL; |
1138 | mutex_unlock(&bdev->bd_mutex); | 1140 | mutex_unlock(&bdev->bd_mutex); |
1139 | disk_unblock_events(disk); | 1141 | disk_unblock_events(disk); |
1140 | module_put(disk->fops->owner); | ||
1141 | put_disk(disk); | 1142 | put_disk(disk); |
1143 | module_put(owner); | ||
1142 | goto restart; | 1144 | goto restart; |
1143 | } | 1145 | } |
1144 | } | 1146 | } |
@@ -1194,8 +1196,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1194 | goto out_unlock_bdev; | 1196 | goto out_unlock_bdev; |
1195 | } | 1197 | } |
1196 | /* only one opener holds refs to the module and disk */ | 1198 | /* only one opener holds refs to the module and disk */ |
1197 | module_put(disk->fops->owner); | ||
1198 | put_disk(disk); | 1199 | put_disk(disk); |
1200 | module_put(owner); | ||
1199 | } | 1201 | } |
1200 | bdev->bd_openers++; | 1202 | bdev->bd_openers++; |
1201 | if (for_part) | 1203 | if (for_part) |
@@ -1215,8 +1217,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1215 | out_unlock_bdev: | 1217 | out_unlock_bdev: |
1216 | mutex_unlock(&bdev->bd_mutex); | 1218 | mutex_unlock(&bdev->bd_mutex); |
1217 | disk_unblock_events(disk); | 1219 | disk_unblock_events(disk); |
1218 | module_put(disk->fops->owner); | ||
1219 | put_disk(disk); | 1220 | put_disk(disk); |
1221 | module_put(owner); | ||
1220 | out: | 1222 | out: |
1221 | bdput(bdev); | 1223 | bdput(bdev); |
1222 | 1224 | ||
@@ -1442,14 +1444,15 @@ static int __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) | |||
1442 | if (!bdev->bd_openers) { | 1444 | if (!bdev->bd_openers) { |
1443 | struct module *owner = disk->fops->owner; | 1445 | struct module *owner = disk->fops->owner; |
1444 | 1446 | ||
1445 | put_disk(disk); | ||
1446 | module_put(owner); | ||
1447 | disk_put_part(bdev->bd_part); | 1447 | disk_put_part(bdev->bd_part); |
1448 | bdev->bd_part = NULL; | 1448 | bdev->bd_part = NULL; |
1449 | bdev->bd_disk = NULL; | 1449 | bdev->bd_disk = NULL; |
1450 | if (bdev != bdev->bd_contains) | 1450 | if (bdev != bdev->bd_contains) |
1451 | victim = bdev->bd_contains; | 1451 | victim = bdev->bd_contains; |
1452 | bdev->bd_contains = NULL; | 1452 | bdev->bd_contains = NULL; |
1453 | |||
1454 | put_disk(disk); | ||
1455 | module_put(owner); | ||
1453 | } | 1456 | } |
1454 | mutex_unlock(&bdev->bd_mutex); | 1457 | mutex_unlock(&bdev->bd_mutex); |
1455 | bdput(bdev); | 1458 | bdput(bdev); |