Re: [PATCH] btrfs: Make btrfs_read_disk_super return struct btrfs_disk_super

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

 



On Wed, Apr 15, 2020 at 03:53:46PM +0300, Nikolay Borisov wrote:
> -	if (btrfs_super_bytenr(*disk_super) != bytenr ||
> -	    btrfs_super_magic(*disk_super) != BTRFS_MAGIC) {
> +	if (btrfs_super_bytenr(disk_super) != bytenr ||
> +	    btrfs_super_magic(disk_super) != BTRFS_MAGIC) {
>  		btrfs_release_disk_super(p);
> -		return 1;
> +		return ERR_PTR(-EUCLEAN);

One more question: what's the reason for -EUCLEAN? The condition fails
if the superblock offset is wrong or there's no magic number. Clearly
not a btrfs superblock, this could be returned to the scanning ioctl, or
is called during mount.

At this point the decision is 'is this potentially a btrfs device?' and
the lightest check we do is the offset and magic number. Only after that
the checksum is verified and all the superblock items and from that
point on it's all EUCLEAN, but before that it's EINVAL.



[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