On Thu, Sep 17, 2020 at 7:58 AM Huang Adrian <adrianhuang0...@gmail.com> wrote: > > On Thu, Sep 17, 2020 at 6:42 PM Jan Kara <j...@suse.cz> wrote: > > > > On Thu 17-09-20 02:28:57, Dan Williams wrote: > > > On Wed, Sep 16, 2020 at 8:15 AM Jan Kara <j...@suse.cz> wrote: > > > > > > > > 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") > > > > Tested-by: Adrian Huang <ahuan...@lenovo.com> > > > > Signed-off-by: Jan Kara <j...@suse.cz> > > > > --- > > > > drivers/dax/super.c | 4 ++++ > > > > drivers/md/dm-table.c | 3 +-- > > > > include/linux/dax.h | 11 +++++++++-- > > > > 3 files changed, 14 insertions(+), 4 deletions(-) > > > > > > > > This patch should go in together with Adrian's > > > > https://lore.kernel.org/linux-nvdimm/20200916133923.31-1-adrianhuang0...@gmail.com > > > > > > > > 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; > > > > + > > > > > > Hi Jan, Thanks for this. > > > > > > > if (!dax_alive(dax_dev)) > > > > return false; > > > > > > One small fixup to quiet lockdep because dax_supported() calls > > > dax_alive() it expects that dax_read_lock() is held. So I'm testing > > > with this incremental change: > > > > > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > > > index bed1ff0744ec..229f461e7def 100644 > > > --- a/drivers/md/dm-table.c > > > +++ b/drivers/md/dm-table.c > > > @@ -860,9 +860,14 @@ EXPORT_SYMBOL_GPL(dm_table_set_type); > > > int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, > > > sector_t start, sector_t len, void *data) > > > { > > > - int blocksize = *(int *) data; > > > + int blocksize = *(int *) data, id; > > > + bool rc; > > > > > > - return dax_supported(dev->dax_dev, dev->bdev, blocksize, start, > > > len); > > > + id = dax_read_lock(); > > > + rc = dax_supported(dev->dax_dev, dev->bdev, blocksize, start, > > > len); > > > + dax_read_unlock(id); > > > + > > > + return rc; > > > } > > > > Yeah, thanks for this! I was actually looking into this when writing the > > patch and somehow convinced myself we will always be called through > > bdev_dax_supported() which does dax_read_lock() for us. But apparently I > > was wrong... > > Hold on. This patch hit another regression when I ran the full test of > the lvm2-testsuite tool today.
Are you sure it's this patch? The dax_read_lock() should have zero interaction with the synchronize_srcu() that __dm_suspend() performs. The too srcu domains should not conflict... I don't even see a dax_read_lock() in this path. _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-le...@lists.01.org