On Tuesday, June 14, 2016 02:33:43 PM Liu Bo wrote:
> Right now stripesize is set to 4096 while sectorsize is set to
> max(4096, pagesize).  However, kernel requires super_stripesize
> to match with sectorsize.
> 
> Reported-by: Eryu Guan <guane...@gmail.com>
> Signed-off-by: Liu Bo <bo.li....@oracle.com>
> ---
>  mkfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mkfs.c b/mkfs.c
> index a3a3c14..8d00766 100644
> --- a/mkfs.c
> +++ b/mkfs.c
> @@ -1482,6 +1482,8 @@ int main(int argc, char **argv)
>       }
> 
>       sectorsize = max(sectorsize, (u32)sysconf(_SC_PAGESIZE));
> +     stripesize = sectorsize;
> +
>       saved_optind = optind;
>       dev_cnt = argc - optind;
>       if (dev_cnt == 0)

Hello Liu Bo,

We have to fix the following check in check_super() as well,

       if (btrfs_super_stripesize(sb) != 4096) {
                error("invalid stripesize %u", btrfs_super_stripesize(sb));
                goto error_out;
        }

i.e. btrfs_super_stripesize(sb) must be equal to
btrfs_super_sectorsize(sb).

However in btrfs-progs (mkfs.c to be precise) since we had stripesize
hardcoded to 4096, setting stripesize to the value of sectorsize in
mkfs.c will cause the following to occur when mkfs.btrfs is invoked for
devices with existing Btrfs filesystem instances,

NOTE: Assume we have changed the stripesize validation in btrfs-progs'
check_super() to,

        if (btrfs_super_stripesize(sb) != btrfs_super_sectorsize(sb)) {
                error("invalid stripesize %u", btrfs_super_stripesize(sb));
                goto error_out;
        }


main()
 for each device file passed as an argument,
   test_dev_for_mkfs()
     check_mounted
       check_mounted_where
         btrfs_scan_one_device
           btrfs_read_dev_super
             check_super() call will fail for existing filesystems which have
             stripesize set to 4k. All existing filesystem instances will fall
             into this category.

This error value is pushed up the call stack and this causes the device to not
get added to the fs_devices_mnt list in check_mounted_where(). Hence we would
fail to correctly check the mount status of the multi-device btrfs
filesystems.

I will try to figure out a solution to this problem.

-- 
chandan

--
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

Reply via email to