aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-23 11:24:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-23 11:31:58 -0400
commit03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch)
treefbaf8738296b2e9dcba81c6daef2d515b6c4948c /drivers/md/dm.c
parent6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff)
parentf36b7534b83357cf52e747905de6d65b4f7c2512 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here... For the mac80211 stuff, these were fortunately just parallel adds. Trivially resolved. In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the function phy_disable_interrupts() earlier in the file, whilst in 'net-next' the phy_error() call from this function was removed. In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the 'rt_table_id' member of rtable collided with a bug fix in 'net' that added a new struct member "rt_mtu_locked" which needs to be copied over here. The mlxsw driver conflict consisted of net-next separating the span code and definitions into separate files, whilst a 'net' bug fix made some changes to that moved code. The mlx5 infiniband conflict resolution was quite non-trivial, the RDMA tree's merge commit was used as a guide here, and here are their notes: ==================== Due to bug fixes found by the syzkaller bot and taken into the for-rc branch after development for the 4.17 merge window had already started being taken into the for-next branch, there were fairly non-trivial merge issues that would need to be resolved between the for-rc branch and the for-next branch. This merge resolves those conflicts and provides a unified base upon which ongoing development for 4.17 can be based. Conflicts: drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524 (IB/mlx5: Fix cleanup order on unload) added to for-rc and commit b5ca15ad7e61 (IB/mlx5: Add proper representors support) add as part of the devel cycle both needed to modify the init/de-init functions used by mlx5. To support the new representors, the new functions added by the cleanup patch needed to be made non-static, and the init/de-init list added by the representors patch needed to be modified to match the init/de-init list changes made by the cleanup patch. Updates: drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function prototypes added by representors patch to reflect new function names as changed by cleanup patch drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init stage list to match new order from cleanup patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 68136806d365..45328d8b2859 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -458,9 +458,11 @@ static int dm_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
458 return dm_get_geometry(md, geo); 458 return dm_get_geometry(md, geo);
459} 459}
460 460
461static int dm_grab_bdev_for_ioctl(struct mapped_device *md, 461static char *_dm_claim_ptr = "I belong to device-mapper";
462 struct block_device **bdev, 462
463 fmode_t *mode) 463static int dm_get_bdev_for_ioctl(struct mapped_device *md,
464 struct block_device **bdev,
465 fmode_t *mode)
464{ 466{
465 struct dm_target *tgt; 467 struct dm_target *tgt;
466 struct dm_table *map; 468 struct dm_table *map;
@@ -490,6 +492,10 @@ retry:
490 goto out; 492 goto out;
491 493
492 bdgrab(*bdev); 494 bdgrab(*bdev);
495 r = blkdev_get(*bdev, *mode, _dm_claim_ptr);
496 if (r < 0)
497 goto out;
498
493 dm_put_live_table(md, srcu_idx); 499 dm_put_live_table(md, srcu_idx);
494 return r; 500 return r;
495 501
@@ -508,7 +514,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
508 struct mapped_device *md = bdev->bd_disk->private_data; 514 struct mapped_device *md = bdev->bd_disk->private_data;
509 int r; 515 int r;
510 516
511 r = dm_grab_bdev_for_ioctl(md, &bdev, &mode); 517 r = dm_get_bdev_for_ioctl(md, &bdev, &mode);
512 if (r < 0) 518 if (r < 0)
513 return r; 519 return r;
514 520
@@ -528,7 +534,7 @@ static int dm_blk_ioctl(struct block_device *bdev, fmode_t mode,
528 534
529 r = __blkdev_driver_ioctl(bdev, mode, cmd, arg); 535 r = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
530out: 536out:
531 bdput(bdev); 537 blkdev_put(bdev, mode);
532 return r; 538 return r;
533} 539}
534 540
@@ -708,14 +714,13 @@ static void dm_put_live_table_fast(struct mapped_device *md) __releases(RCU)
708static int open_table_device(struct table_device *td, dev_t dev, 714static int open_table_device(struct table_device *td, dev_t dev,
709 struct mapped_device *md) 715 struct mapped_device *md)
710{ 716{
711 static char *_claim_ptr = "I belong to device-mapper";
712 struct block_device *bdev; 717 struct block_device *bdev;
713 718
714 int r; 719 int r;
715 720
716 BUG_ON(td->dm_dev.bdev); 721 BUG_ON(td->dm_dev.bdev);
717 722
718 bdev = blkdev_get_by_dev(dev, td->dm_dev.mode | FMODE_EXCL, _claim_ptr); 723 bdev = blkdev_get_by_dev(dev, td->dm_dev.mode | FMODE_EXCL, _dm_claim_ptr);
719 if (IS_ERR(bdev)) 724 if (IS_ERR(bdev))
720 return PTR_ERR(bdev); 725 return PTR_ERR(bdev);
721 726
@@ -3011,7 +3016,7 @@ static int dm_pr_reserve(struct block_device *bdev, u64 key, enum pr_type type,
3011 fmode_t mode; 3016 fmode_t mode;
3012 int r; 3017 int r;
3013 3018
3014 r = dm_grab_bdev_for_ioctl(md, &bdev, &mode); 3019 r = dm_get_bdev_for_ioctl(md, &bdev, &mode);
3015 if (r < 0) 3020 if (r < 0)
3016 return r; 3021 return r;
3017 3022
@@ -3021,7 +3026,7 @@ static int dm_pr_reserve(struct block_device *bdev, u64 key, enum pr_type type,
3021 else 3026 else
3022 r = -EOPNOTSUPP; 3027 r = -EOPNOTSUPP;
3023 3028
3024 bdput(bdev); 3029 blkdev_put(bdev, mode);
3025 return r; 3030 return r;
3026} 3031}
3027 3032
@@ -3032,7 +3037,7 @@ static int dm_pr_release(struct block_device *bdev, u64 key, enum pr_type type)
3032 fmode_t mode; 3037 fmode_t mode;
3033 int r; 3038 int r;
3034 3039
3035 r = dm_grab_bdev_for_ioctl(md, &bdev, &mode); 3040 r = dm_get_bdev_for_ioctl(md, &bdev, &mode);
3036 if (r < 0) 3041 if (r < 0)
3037 return r; 3042 return r;
3038 3043
@@ -3042,7 +3047,7 @@ static int dm_pr_release(struct block_device *bdev, u64 key, enum pr_type type)
3042 else 3047 else
3043 r = -EOPNOTSUPP; 3048 r = -EOPNOTSUPP;
3044 3049
3045 bdput(bdev); 3050 blkdev_put(bdev, mode);
3046 return r; 3051 return r;
3047} 3052}
3048 3053
@@ -3054,7 +3059,7 @@ static int dm_pr_preempt(struct block_device *bdev, u64 old_key, u64 new_key,
3054 fmode_t mode; 3059 fmode_t mode;
3055 int r; 3060 int r;
3056 3061
3057 r = dm_grab_bdev_for_ioctl(md, &bdev, &mode); 3062 r = dm_get_bdev_for_ioctl(md, &bdev, &mode);
3058 if (r < 0) 3063 if (r < 0)
3059 return r; 3064 return r;
3060 3065
@@ -3064,7 +3069,7 @@ static int dm_pr_preempt(struct block_device *bdev, u64 old_key, u64 new_key,
3064 else 3069 else
3065 r = -EOPNOTSUPP; 3070 r = -EOPNOTSUPP;
3066 3071
3067 bdput(bdev); 3072 blkdev_put(bdev, mode);
3068 return r; 3073 return r;
3069} 3074}
3070 3075
@@ -3075,7 +3080,7 @@ static int dm_pr_clear(struct block_device *bdev, u64 key)
3075 fmode_t mode; 3080 fmode_t mode;
3076 int r; 3081 int r;
3077 3082
3078 r = dm_grab_bdev_for_ioctl(md, &bdev, &mode); 3083 r = dm_get_bdev_for_ioctl(md, &bdev, &mode);
3079 if (r < 0) 3084 if (r < 0)
3080 return r; 3085 return r;
3081 3086
@@ -3085,7 +3090,7 @@ static int dm_pr_clear(struct block_device *bdev, u64 key)
3085 else 3090 else
3086 r = -EOPNOTSUPP; 3091 r = -EOPNOTSUPP;
3087 3092
3088 bdput(bdev); 3093 blkdev_put(bdev, mode);
3089 return r; 3094 return r;
3090} 3095}
3091 3096