Re: [PATCH 1/2] btrfs-progs: mkfs: Prevent temporary system chunk to use space in reserved 1M range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2018年01月24日 00:42, David Sterba wrote:
> On Wed, Jan 10, 2018 at 12:56:47PM +0800, Qu Wenruo wrote:
>> When creating btrfs, mkfs.btrfs will firstly create a temporary system
>> chunk as basis, and then created needed trees or new devices.
>>
>> However the layout temporary system chunk is hard-coded and uses
>> reserved [0, 1M) range of devid 1.
>>
>> Change the temporary chunk layout from old:
>>
>> 0	1M				4M	5M
>> |<----------- temp chunk -------------->|
>>   And it's 1:1 mapped, which means it's a SINGLE chunk,
>>   and stripe offset is also 0.
>>
>> to new layout:
>>
>> 0	1M				4M	5M
>> 	|<----------- temp chunk -------------->|
>>   And still keeps the 1:1 mapping.
>>
>> The problem can only be exposed by "-m single" or "-M" where we reuse the
>> temporary chunk.
>>
>> With other meta profiles, system and meta chunks are allocated by later
>> btrfs_alloc_chunk() call, and old SINGLE chunks are removed, so it will
>> be no such problem for other meta profiles.
>>
>> Reported-by: Nikolay Borisov <nborisov@xxxxxxxx>
>> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> 
> The test mkfs-tests/010-minimal-size fails with this patch (devel
> branch). I've added some debugging and the requested minimal size by
> mkfs is not sufficient. I think it's because of the 1MB shift but
> haven't looked closely.

Patch under the way.

And this reminds me to refactor btrfs_alloc_chunk() to allow caller get
minimal chunk size to use other than manually read the code.

Thanks,
Qu

> 
> The math in "btrfs-progs: mkfs: move source dir size calculation to its
> own files" may need to be updated, I'm not sure how exactly to do that.
> It would be good if you find the fix and we'll then see where to put it
> (separate patch or fold it to some other one).
> 
> Otherwise I'm going to apply patches 1 and 2, thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux