Re: [PATCH 1/2] Btrfs: add more valid checks for superblock

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

 



On Thu, May 05, 2016 at 09:08:54AM +0800, Qu Wenruo wrote:
> >> An early check can compare against some reasonable value, but the
> >> total_bytes value must be equal to the sum of all device sizes
> >> (disk_total_bytes). I'm not sure if we have enough information to verify
> >> that at this point though.
> >
> > That's what I had in mind, the problem is that only the first device information is recorded in superblock.
> >
> > At this moment We have device_num but we don't know the size of other devices.
> >
> > Thanks,
> >
> > -liubo
> >
> >
> What about error out if we found sb->total_bytes < 
> sb->dev_item->total_bytes?
> 
> As we are just doing early check, no need to be comprehensive, but spot 
> obvious problem.

Ok.

> For exact device_num and sb->total_bytes, we may do post check when 
> device tree are loaded?
> Splitting early_check() and post_check() seems valid for me.
> (Also I prefer post_check() just warning, not forced exit)

Why just warning? Superblock total_bytes and device sizes must be
correct, otherwise all sorts of operations can fail randomly.
--
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




[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