Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752451AbbEKQI2 (ORCPT ); Mon, 11 May 2015 12:08:28 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34504 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751933AbbEKQI0 (ORCPT ); Mon, 11 May 2015 12:08:26 -0400 Date: Mon, 11 May 2015 18:08:24 +0200 From: David Sterba To: Omar Sandoval Cc: Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Qu Wenruo Subject: Re: [PATCH v2 2/6] Btrfs: remove all subvol options before mounting top-level Message-ID: <20150511160824.GQ23255@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Omar Sandoval , Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Qu Wenruo References: <8ead0eb0e24aac86fae1d748853ed64e3a4161d9.1428614837.git.osandov@osandov.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ead0eb0e24aac86fae1d748853ed64e3a4161d9.1428614837.git.osandov@osandov.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1415 Lines: 31 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 Reviewed-by: David Sterba -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/