Re: [PATCH v2] dm: Call proper helper to determine dax support
From: Naresh Kamboju
Date: Mon Sep 21 2020 - 01:53:25 EST
On Fri, 18 Sep 2020 at 11:18, Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
>
> From: Jan Kara <jack@xxxxxxx>
>
> DM was calling generic_fsdax_supported() to determine whether a device
> referenced in the DM table supports DAX. However this is a helper for "leaf" device drivers so that
> they don't have to duplicate common generic checks. High level code
> should call dax_supported() helper which that calls into appropriate
> helper for the particular device. This problem manifested itself as
> kernel messages:
>
> dm-3: error: dax access failed (-95)
>
> when lvm2-testsuite run in cases where a DM device was stacked on top of
> another DM device.
>
> Fixes: 7bf7eac8d648 ("dax: Arrange for dax_supported check to span multiple devices")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Tested-by: Adrian Huang <ahuang12@xxxxxxxxxx>
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> Acked-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
> ---
> Changes since v1 [1]:
> - Add missing dax_read_lock() around dax_supported()
>
> [1]: http://lore.kernel.org/r/20200916151445.450-1-jack@xxxxxxx
>
> drivers/dax/super.c | 4 ++++
> drivers/md/dm-table.c | 10 +++++++---
> include/linux/dax.h | 11 +++++++++--
> 3 files changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dax/super.c b/drivers/dax/super.c
> index e5767c83ea23..b6284c5cae0a 100644
> --- a/drivers/dax/super.c
> +++ b/drivers/dax/super.c
> @@ -325,11 +325,15 @@ EXPORT_SYMBOL_GPL(dax_direct_access);
> bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
> int blocksize, sector_t start, sector_t len)
> {
> + if (!dax_dev)
> + return false;
> +
> if (!dax_alive(dax_dev))
> return false;
>
> return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len);
> }
> +EXPORT_SYMBOL_GPL(dax_supported);
arm build error while building with allmodconfig.
../drivers/dax/super.c:325:6: error: redefinition of ‘dax_supported’
325 | bool dax_supported(struct dax_device *dax_dev, struct
block_device *bdev,
| ^~~~~~~~~~~~~
In file included from ../drivers/dax/super.c:16:
../include/linux/dax.h:162:20: note: previous definition of
‘dax_supported’ was here
162 | static inline bool dax_supported(struct dax_device *dax_dev,
| ^~~~~~~~~~~~~
make[3]: *** [../scripts/Makefile.build:283: drivers/dax/super.o] Error 1
Reported-by: Naresh Kamboju <naresh.kamboju@xxxxxxxxxx>
Ref:
https://builds.tuxbuild.com/IO690jFQDp0qP9zFuWBqpA/build.log