Re: [PATCH] libnvdimm: fix btt vs clear poison locking

From: Jeff Moyer
Date: Tue Apr 11 2017 - 16:08:50 EST


Dan Williams <dan.j.williams@xxxxxxxxx> writes:

> As a minimal fix, disable error clearing when the BTT is enabled. For
> the final fix a larger rework of the poison list locking is needed.

> @@ -243,7 +243,15 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
> }
>
> if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) {
> - if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)) {
> + /*
> + * FIXME: nsio_rw_bytes() may be called from atomic
> + * context in the BTT case and nvdimm_clear_poison()
> + * takes a sleeping lock. Until the locking can be
> + * reworked this capability depends on !BTT or BROKEN.
> + */
> + if ((!IS_ENABLED(CONFIG_BTT) || IS_ENABLED(CONFIG_BROKEN))
> + && IS_ALIGNED(offset, 512)
> + && IS_ALIGNED(size, 512)) {

I don't like that you've disabled clear error just because the btt
driver was enabled. Can't you do something like this, instead?

disable_clear_poison = (ndns->claim && is_nd_btt(ndns->claim));

if (!disable_clear_poison && IS_ALIGNED(offset, 512)...

-Jeff