On Fri, 18 Sep 2020 at 11:18, Dan Williams dan.j.williams@intel.com wrote:
From: Jan Kara jack@suse.cz
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@vger.kernel.org Tested-by: Adrian Huang ahuang12@lenovo.com Signed-off-by: Jan Kara jack@suse.cz Acked-by: Mike Snitzer snitzer@redhat.com Signed-off-by: Dan Williams dan.j.williams@intel.com
Changes since v1 [1]:
- Add missing dax_read_lock() around dax_supported()
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@linaro.org
Ref: https://builds.tuxbuild.com/IO690jFQDp0qP9zFuWBqpA/build.log
On Mon 21-09-20 11:23:07, Naresh Kamboju wrote:
On Fri, 18 Sep 2020 at 11:18, Dan Williams dan.j.williams@intel.com wrote:
From: Jan Kara jack@suse.cz
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@vger.kernel.org Tested-by: Adrian Huang ahuang12@lenovo.com Signed-off-by: Jan Kara jack@suse.cz Acked-by: Mike Snitzer snitzer@redhat.com Signed-off-by: Dan Williams dan.j.williams@intel.com
Changes since v1 [1]:
- Add missing dax_read_lock() around dax_supported()
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@linaro.org
Ref: https://builds.tuxbuild.com/IO690jFQDp0qP9zFuWBqpA/build.log
Thanks for report! Attached patch should fix the build (at least I've tested it with CONFIG_DAX && CONFIG_FS_DAX, CONFIG_DAX && !CONFIG_FS_DAX, and !CONFIG_DAX cases). Dan can you please merge the fix?
Honza