Re: [PATCH 2/2] libnvdimm, dax: fix alignment validation

From: Johannes Thumshirn
Date: Mon May 23 2016 - 05:18:07 EST


On Wed, May 18, 2016 at 04:44:07PM -0700, Dan Williams wrote:
> Testing the dax-device autodetect support revealed a probe failure with
> the following result:
>
> dax0.1: bad offset: 0x8200000 dax disabled
>
> The original pfn-device implementation inferred the alignment from
> ilog2(offset), now that the alignment is explicit the is_power_of_2()
> needs replacing with a real sanity check against the recorded alignment.
> Otherwise the alignment check is useless in the implicit case and only
> the minimum size of the offset matters.
>
> This self-consistency check is further validated by the probe path that
> will re-check that the offset is large enough to contain all the
> metadata required to enable the device.
>
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>

Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>

--
Johannes Thumshirn Storage
jthumshirn@xxxxxxx +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850