On 2018年04月24日 18:48, David Sterba wrote:
> On Tue, Apr 24, 2018 at 12:48:07PM +0800, Qu Wenruo wrote:
>> Although we have already checked incompat flags manually before really
>> mounting it, we could still enhance btrfs_check_super_valid() to check
>> incompat flags for later write time super block validation check.
> 
> But the calls are in reverse. First the validation is called and then
> the incompat bits are verified if the filesystem is mountable.
> 
> With change in this patch, any uknonwn incompat bit at mount time will
> be reported as corruption. This does not make sense.

Oh sorry, I just though incompat flags is checked before calling
btrfs_validate_super().

> 
> I've read the discussion under previous version again, IMHO the best way
> to report what's going on is to use 2 functions for mount ant pre-commit
> time.

OK, next version will go that direction.

Although it may still be a little tricky to split what we need in
btrfs_validate_super() and btrfs_precheck_super().

What about this idea:
- btrfs_precheck_super() only checks the very basis:
  * magic
  * incompat flags
  * csum type
  Any mismatch will do friendly prompt ("no btrfs detected" or
  "unsupported flags/csum type" respectively)

- btrfs_validate_super() do the comprehensive check:
  * Everything we did in this patchset
  * including magic, incompat flags and csum type
  Any mismatch will be considered as corruption.

For mount time, we call btrfs_precheck_super() then btrfs_validate_super().

For commit time, only btrfs_validate_super().

How about this solution?

Thanks,
Qu
> 
> We can't expect that random user will understand that new unsupported
> flags actually mean corruption or that unsupported bits at mount time
> are not really a corruption.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to