lkml.org 
[lkml]   [2015]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/6] Btrfs: remove all subvol options before mounting top-level
On Thu, Apr 09, 2015 at 02:34:52PM -0700, Omar Sandoval wrote:
> Currently, setup_root_args() substitutes 's/subvol=[^,]*/subvolid=0/'.
> But, this means that if the user passes both a subvol and subvolid for
> some reason, we won't actually mount the top-level when we recursively
> mount. For example, consider:
>
> mkfs.btrfs -f /dev/sdb
> mount /dev/sdb /mnt
> btrfs subvol create /mnt/subvol1 # subvolid=257
> btrfs subvol create /mnt/subvol2 # subvolid=258
> umount /mnt
> mount -osubvol=/subvol1,subvolid=258 /dev/sdb /mnt
>
> In the final mount, subvol=/subvol1,subvolid=258 becomes
> subvolid=0,subvolid=258, and the last option takes precedence, so we
> mount subvol2 and try to look up subvol1 inside of it, which fails.
>
> So, instead, do a thorough scan through the argument list and remove any
> subvol= and subvolid= options, then append subvolid=0 to the end. This
> implicitly makes subvol= take precedence over subvolid=, but we're about
> to add a stricter check for that. This also makes setup_root_args() more
> generic, which we'll need soon.
>
> Signed-off-by: Omar Sandoval <osandov@osandov.com>

Reviewed-by: David Sterba <dsterba@suse.cz>


\
 
 \ /
  Last update: 2015-05-11 18:41    [W:0.101 / U:16.792 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site