Re: [PATCH 3/3] dm zoned: handle labels that are not NUL-terminated

From: Damien Le Moal

Date: Thu Dec 03 2026 - 01:42:21 EST


On 2026/12/03 1:31, Yingjie Wang wrote:
> Hi Damien,
>
> On 12/2/26 14:53, Damien Le Moal wrote:
>> No, I think the extra byte is still needed to be able to honor a device name up
>> to BDEVNAME_SIZE with a NUL terminating character. That needs to stay.
>
> OK, but then I'm not sure the check is still wanted. With the extra
> byte, a label that uses all 32 bytes is NUL-terminated in zmd->label,
> so it can be supported. If labels without a NUL in the 32 bytes on
> disk are rejected, a label has at most 31 characters, and the extra
> byte is never used.

Yeah, good point. With the extra byte added, the last byte is always NUL and so
the check can go away. That is better than the alternative as we can honor the
max name size of BDEVNAME_SIZE, that is, 32 characters.

>
> So which do you prefer?
>
> 1) Accept such labels: keep the extra byte, and print at most 32
> characters of the label read from disk, as in v1. Volumes created
> by dmzadm 2.0.0 to 2.1.3 with long device names can still be loaded.
>
> 2) Reject them: add the check. These volumes then have to be
> relabeled with dmzadm 2.2.0 or later. The extra byte doesn't hurt,
> but it isn't needed.
>
> I'm fine with either, and will do v2 accordingly.
>
> 1/3 and 2/3 don't depend on this patch, in case they can go in first.
>
> Thanks,
> Yingjie


--
Damien Le Moal
Western Digital Research