Re: [PATCH v8 3/4] Adds blk_interposer to md.
Hi Sergei, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on block/for-next] [also build test WARNING on hch-configfs/for-next v5.12-rc6] [cannot apply to dm/for-next next-20210409] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sergei-Shtepa/block-device-interposer/20210409-194943 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: x86_64-randconfig-s032-20210409 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-279-g6d5d9b42-dirty # https://github.com/0day-ci/linux/commit/df79fb333cb0a1263a1f03f54de425507e3c2238 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sergei-Shtepa/block-device-interposer/20210409-194943 git checkout df79fb333cb0a1263a1f03f54de425507e3c2238 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) >> drivers/md/dm-table.c:337:63: sparse: sparse: incorrect type in argument 3 >> (different base types) @@ expected restricted fmode_t [usertype] mode @@ >> got bool [usertype] interpose @@ drivers/md/dm-table.c:337:63: sparse: expected restricted fmode_t [usertype] mode drivers/md/dm-table.c:337:63: sparse: got bool [usertype] interpose -- >> drivers/md/dm.c:2682:5: sparse: sparse: symbol '__dm_attach_interposer' was >> not declared. Should it be static? >> drivers/md/dm.c:2724:5: sparse: sparse: symbol '__dm_detach_interposer' was >> not declared. Should it be static? Please review and possibly fold the followup patch. vim +337 drivers/md/dm-table.c 322 323 /* 324 * This upgrades the mode on an already open dm_dev, being 325 * careful to leave things as they were if we fail to reopen the 326 * device and not to touch the existing bdev field in case 327 * it is accessed concurrently. 328 */ 329 static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, 330 bool interpose, struct mapped_device *md) 331 { 332 int r; 333 struct dm_dev *old_dev, *new_dev; 334 335 old_dev = dd->dm_dev; 336 > 337 r = dm_get_table_device(md, dd->dm_dev->bdev->bd_dev, interpose, 338 dd->dm_dev->mode | new_mode, _dev); 339 if (r) 340 return r; 341 342 dd->dm_dev = new_dev; 343 dm_put_table_device(md, old_dev); 344 345 return 0; 346 } 347 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH v8 3/4] Adds blk_interposer to md.
Hi Sergei, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on block/for-next] [also build test WARNING on hch-configfs/for-next v5.12-rc6] [cannot apply to dm/for-next next-20210409] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sergei-Shtepa/block-device-interposer/20210409-194943 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: i386-randconfig-m021-20210409 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/df79fb333cb0a1263a1f03f54de425507e3c2238 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sergei-Shtepa/block-device-interposer/20210409-194943 git checkout df79fb333cb0a1263a1f03f54de425507e3c2238 # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/md/dm.c:2682:5: warning: no previous prototype for >> '__dm_attach_interposer' [-Wmissing-prototypes] 2682 | int __dm_attach_interposer(struct mapped_device *md) | ^~ >> drivers/md/dm.c:2724:5: warning: no previous prototype for >> '__dm_detach_interposer' [-Wmissing-prototypes] 2724 | int __dm_detach_interposer(struct mapped_device *md) | ^~ vim +/__dm_attach_interposer +2682 drivers/md/dm.c 2681 > 2682 int __dm_attach_interposer(struct mapped_device *md) 2683 { 2684 int r; 2685 struct dm_table *map; 2686 struct block_device *original_bdev = NULL; 2687 2688 if (dm_interposer_attached(md)) 2689 return 0; 2690 2691 map = rcu_dereference_protected(md->map, 2692 lockdep_is_held(>suspend_lock)); 2693 if (!map) { 2694 DMERR("%s: interposers table is not initialized", 2695 dm_device_name(md)); 2696 return -EINVAL; 2697 } 2698 2699 original_bdev = get_interposed_bdev(map); 2700 if (!original_bdev) { 2701 DMERR("%s: interposer cannot get interposed device from table", 2702 dm_device_name(md)); 2703 return -EINVAL; 2704 } 2705 2706 bdev_interposer_lock(original_bdev); 2707 2708 r = bdev_interposer_attach(original_bdev, dm_disk(md)->part0); 2709 if (r) 2710 DMERR("%s: failed to attach interposer", 2711 dm_device_name(md)); 2712 else 2713 set_bit(DMF_INTERPOSER_ATTACHED, >flags); 2714 2715 bdev_interposer_unlock(original_bdev); 2716 2717 unlock_bdev_fs(md, original_bdev); 2718 2719 bdput(original_bdev); 2720 2721 return r; 2722 } 2723 > 2724 int __dm_detach_interposer(struct mapped_device *md) 2725 { 2726 struct dm_table *map = NULL; 2727 struct block_device *original_bdev; 2728 2729 if (!dm_interposer_attached(md)) 2730 return 0; 2731 /* 2732 * If mapped device is suspended, but should be detached 2733 * we just detach without freeze fs on interposed device. 2734 */ 2735 map = rcu_dereference_protected(md->map, 2736 lockdep_is_held(>suspend_lock)); 2737 if (!map) { 2738 /* 2739 * If table is not initialized then interposed device 2740 * cannot be attached 2741 */ 2742 DMERR("%s: table is not initialized for device", 2743 dm_device_name(md)); 2744 return -EINVAL; 2745 } 2746 2747 original_bdev = get_interposed_bdev(map); 2748 if (!original_bdev) { 2749 DMERR("%s: interposer cannot get interposed device from table", 2750 dm_device_name(md)); 2751 return -EINVAL; 2752 } 2753 2754 bdev_interposer_lock(original_bdev); 2755 2756 bdev_interposer_detach(original_bdev); 2757 clear_bit(DMF_INTERPOSER_ATTACHED, >flags); 2758 2759 bdev_interposer_unlock(original_bdev); 2760 2761 bdput(original_bdev); 2762 return 0; 2763 } 2764 /* 2765 * We need to be able to change a mapping table under a mounted
Re: [PATCH v8 3/4] Adds blk_interposer to md.
Hi Sergei, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on block/for-next] [also build test WARNING on hch-configfs/for-next v5.12-rc6] [cannot apply to dm/for-next next-20210409] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Sergei-Shtepa/block-device-interposer/20210409-194943 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: arm-randconfig-r025-20210409 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project dd453a1389b6a7e6d9214b449d3c54981b1a89b6) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://github.com/0day-ci/linux/commit/df79fb333cb0a1263a1f03f54de425507e3c2238 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sergei-Shtepa/block-device-interposer/20210409-194943 git checkout df79fb333cb0a1263a1f03f54de425507e3c2238 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/md/dm.c:2682:5: warning: no previous prototype for function >> '__dm_attach_interposer' [-Wmissing-prototypes] int __dm_attach_interposer(struct mapped_device *md) ^ drivers/md/dm.c:2682:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __dm_attach_interposer(struct mapped_device *md) ^ static >> drivers/md/dm.c:2724:5: warning: no previous prototype for function >> '__dm_detach_interposer' [-Wmissing-prototypes] int __dm_detach_interposer(struct mapped_device *md) ^ drivers/md/dm.c:2724:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __dm_detach_interposer(struct mapped_device *md) ^ static 2 warnings generated. vim +/__dm_attach_interposer +2682 drivers/md/dm.c 2681 > 2682 int __dm_attach_interposer(struct mapped_device *md) 2683 { 2684 int r; 2685 struct dm_table *map; 2686 struct block_device *original_bdev = NULL; 2687 2688 if (dm_interposer_attached(md)) 2689 return 0; 2690 2691 map = rcu_dereference_protected(md->map, 2692 lockdep_is_held(>suspend_lock)); 2693 if (!map) { 2694 DMERR("%s: interposers table is not initialized", 2695 dm_device_name(md)); 2696 return -EINVAL; 2697 } 2698 2699 original_bdev = get_interposed_bdev(map); 2700 if (!original_bdev) { 2701 DMERR("%s: interposer cannot get interposed device from table", 2702 dm_device_name(md)); 2703 return -EINVAL; 2704 } 2705 2706 bdev_interposer_lock(original_bdev); 2707 2708 r = bdev_interposer_attach(original_bdev, dm_disk(md)->part0); 2709 if (r) 2710 DMERR("%s: failed to attach interposer", 2711 dm_device_name(md)); 2712 else 2713 set_bit(DMF_INTERPOSER_ATTACHED, >flags); 2714 2715 bdev_interposer_unlock(original_bdev); 2716 2717 unlock_bdev_fs(md, original_bdev); 2718 2719 bdput(original_bdev); 2720 2721 return r; 2722 } 2723 > 2724 int __dm_detach_interposer(struct mapped_device *md) 2725 { 2726 struct dm_table *map = NULL; 2727 struct block_device *original_bdev; 2728 2729 if (!dm_interposer_attached(md)) 2730 return 0; 2731 /* 2732 * If mapped device is suspended, but should be detached 2733 * we just detach without freeze fs on interposed device. 2734 */ 2735 map = rcu_dereference_protected(md->map, 2736 lockdep_is_held(>suspend_lock)); 2737 if (!map) { 2738 /* 2739 * If table is not initialized then interposed device 2740 * cannot be attached 2741 */ 2742 DMERR("%s: table is not initialized for device", 2743 dm_device_name(md)); 2744 return -EINVAL;