btrfs: prevent to set invalid default subvolid
authorsatoru takeuchi <satoru.takeuchi@gmail.com>
Tue, 12 Sep 2017 13:42:52 +0000 (22:42 +0900)
committerWilly Tarreau <w@1wt.eu>
Thu, 2 Nov 2017 09:46:02 +0000 (10:46 +0100)
commit827a5cb0a0ad3a74426a4e0d12cbc59917785fa2
treefde0fc413df0f2a9cdeb75c76897719f80e973dd
parent7210062e8fc3e0f9519382c0ad2df3266989a96d
btrfs: prevent to set invalid default subvolid

commit 6d6d282932d1a609e60dc4467677e0e863682f57 upstream.

`btrfs sub set-default` succeeds to set an ID which isn't corresponding to any
fs/file tree. If such the bad ID is set to a filesystem, we can't mount this
filesystem without specifying `subvol` or `subvolid` mount options.

Fixes: 6ef5ed0d386b ("Btrfs: add ioctl and incompat flag to set the default mount subvol")
Cc: <stable@vger.kernel.org>
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Reviewed-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
fs/btrfs/ioctl.c