Re: [PATCH v8 3/4] Adds blk_interposer to md.
From: kernel test robot
Date: Fri Apr 09 2021 - 10:12:46 EST
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 <lkp@xxxxxxxxx>
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(&md->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, &md->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(&md->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, &md->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
2766 * filesystem. For example we might want to move some data in
2767 * the background. Before the table can be swapped with
2768 * dm_bind_table, dm_suspend must be called to flush any in
2769 * flight bios and ensure that any further io gets deferred.
2770 */
2771 /*
2772 * Suspend mechanism in request-based dm.
2773 *
2774 * 1. Flush all I/Os by lock_fs() if needed.
2775 * 2. Stop dispatching any I/O by stopping the request_queue.
2776 * 3. Wait for all in-flight I/Os to be completed or requeued.
2777 *
2778 * To abort suspend, start the request_queue.
2779 */
2780 int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
2781 {
2782 struct dm_table *map = NULL;
2783 int r = 0;
2784
2785 retry:
2786 mutex_lock_nested(&md->suspend_lock, SINGLE_DEPTH_NESTING);
2787
2788 if (dm_suspended_md(md)) {
2789 if (suspend_flags & DM_SUSPEND_DETACH_IP_FLAG)
2790 r = __dm_detach_interposer(md);
2791 else
2792 r = -EINVAL;
2793
2794 goto out_unlock;
2795 }
2796
2797 if (dm_suspended_internally_md(md)) {
2798 /* already internally suspended, wait for internal resume */
2799 mutex_unlock(&md->suspend_lock);
2800 r = wait_on_bit(&md->flags, DMF_SUSPENDED_INTERNALLY, TASK_INTERRUPTIBLE);
2801 if (r)
2802 return r;
2803 goto retry;
2804 }
2805
2806 map = rcu_dereference_protected(md->map, lockdep_is_held(&md->suspend_lock));
2807
2808 r = __dm_suspend(md, map, suspend_flags, TASK_INTERRUPTIBLE, DMF_SUSPENDED);
2809 if (r)
2810 goto out_unlock;
2811
2812 set_bit(DMF_POST_SUSPENDING, &md->flags);
2813 dm_table_postsuspend_targets(map);
2814 clear_bit(DMF_POST_SUSPENDING, &md->flags);
2815
2816 out_unlock:
2817 mutex_unlock(&md->suspend_lock);
2818 return r;
2819 }
2820
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip