OSDN Git Service

libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC
authorVaibhav Jain <vaibhav@linux.ibm.com>
Fri, 2 Apr 2021 09:25:55 +0000 (14:55 +0530)
committerDan Williams <dan.j.williams@intel.com>
Sat, 10 Apr 2021 04:56:01 +0000 (21:56 -0700)
commita2948b17f6b936fc52f86c0f92c46d2f91928b79
treea3155898cd4806290ceb1fd9b2609003c0d6399f
parent2361db89aaadfb671db6911b0063e01ec8922c28
libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC

In case a platform doesn't provide explicit flush-hints but provides an
explicit flush callback via ND_REGION_ASYNC region flag, then
nvdimm_has_flush() still returns '0' indicating that writes do not
require flushing. This happens on PPC64 with patch at [1] applied, where
'deep_flush' of a region was denied even though an explicit flush
function was provided.

Fix this by adding a condition to nvdimm_has_flush() to test for the
ND_REGION_ASYNC flag on the region and see if a 'region->flush' callback
is assigned.

Link: http://lore.kernel.org/r/161703936121.36.7260632399582101498.stgit@e1fbed493c87
Fixes: c5d4355d10d4 ("libnvdimm: nd_region flush callback support")
Reported-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Link: https://lore.kernel.org/r/20210402092555.208590-1-vaibhav@linux.ibm.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/region_devs.c