Re: [PATCH] libnvdimm: fix btt vs clear poison locking
From: Dan Williams
Date: Tue Apr 11 2017 - 16:10:30 EST
On Tue, Apr 11, 2017 at 1:08 PM, Jeff Moyer <jmoyer@xxxxxxxxxx> wrote:
> 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?
Ooh, yes we can and that's much better.