linux/drivers/dax
Coly Li 6180bb446a dax: fix detection of dax support for non-persistent memory block devices
When calling __generic_fsdax_supported(), a dax-unsupported device may
not have dax_dev as NULL, e.g. the dax related code block is not enabled
by Kconfig.

Therefore in __generic_fsdax_supported(), to check whether a device
supports DAX or not, the following order of operations should be
performed:
- If dax_dev pointer is NULL, it means the device driver explicitly
  announce it doesn't support DAX. Then it is OK to directly return
  false from __generic_fsdax_supported().
- If dax_dev pointer is NOT NULL, it might be because the driver doesn't
  support DAX and not explicitly initialize related data structure. Then
  bdev_dax_supported() should be called for further check.

If device driver desn't explicitly set its dax_dev pointer to NULL,
this is not a bug. Calling bdev_dax_supported() makes sure they can be
recognized as dax-unsupported eventually.

Fixes: c2affe920b ("dax: do not print error message for non-persistent memory block device")
Cc: Jan Kara <jack@suse.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-and-tested-by: Adrian Huang <ahuang12@lenovo.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/20200903161625.19524-1-colyli@suse.de
2020-09-03 12:28:03 -06:00
..
pmem libnvdimm/namespace: Differentiate between probe mapping and runtime mapping 2019-11-14 19:08:47 -08:00
bus.c dax: Move mandatory ->zero_page_range() check in alloc_dax() 2020-04-02 19:15:03 -07:00
bus.h dax: Fix alloc_dax_region() compile warning 2019-11-07 15:44:47 +01:00
dax-private.h device-dax: add memory via add_memory_driver_managed() 2020-06-04 19:06:23 -07:00
device.c vfs: track per-sb writeback errors and report them to syncfs 2020-06-02 10:59:05 -07:00
hmem.c device-dax: Add a driver for "hmem" devices 2019-11-07 15:45:00 +01:00
Kconfig device-dax: Add a driver for "hmem" devices 2019-11-07 15:45:00 +01:00
kmem.c device-dax: add memory via add_memory_driver_managed() 2020-06-04 19:06:23 -07:00
Makefile device-dax: Add a driver for "hmem" devices 2019-11-07 15:45:00 +01:00
super.c dax: fix detection of dax support for non-persistent memory block devices 2020-09-03 12:28:03 -06:00