All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: allow empty subvol= again
@ 2018-05-22  0:07 Omar Sandoval
  2018-05-22  0:17 ` Omar Sandoval
  0 siblings, 1 reply; 3+ messages in thread
From: Omar Sandoval @ 2018-05-22  0:07 UTC (permalink / raw)
  To: linux-btrfs; +Cc: kernel-team, David Sterba, Tomohiro Misono

From: Omar Sandoval <osandov@fb.com>

I got a report that after upgrading to 4.16, someone's filesystems
weren't mounting:

[   23.845852] BTRFS info (device loop0): unrecognized mount option 'subvol='

Before 4.16, this mounted the default subvolume. It turns out that this
empty "subvol=" is actually an application bug, but it was causing the
application to fail, so it's an ABI break if you squint.

The generic parsing code we use for mount options (match_token())
doesn't match an empty string as "%s". Previously, setup_root_args()
removed the "subvol=" string, but the mount path was cleaned up to not
need that. Add a dummy Opt_subvol_empty to fix this.

Fixes: 312c89fbca06 ("btrfs: cleanup btrfs_mount() using btrfs_mount_root()")
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
Hi, Dave,

This is silly but IMO it's a regression. If you agree, this should
probably go to 4.17 + stable. I'll submit an xfstests test shortly.

Thanks!

 fs/btrfs/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 0628092b0b1b..f82152a0cb38 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -323,6 +323,7 @@ enum {
 	Opt_ssd, Opt_nossd,
 	Opt_ssd_spread, Opt_nossd_spread,
 	Opt_subvol,
+	Opt_subvol_empty,
 	Opt_subvolid,
 	Opt_thread_pool,
 	Opt_treelog, Opt_notreelog,
@@ -388,6 +389,7 @@ static const match_table_t tokens = {
 	{Opt_ssd_spread, "ssd_spread"},
 	{Opt_nossd_spread, "nossd_spread"},
 	{Opt_subvol, "subvol=%s"},
+	{Opt_subvol_empty, "subvol="},
 	{Opt_subvolid, "subvolid=%s"},
 	{Opt_thread_pool, "thread_pool=%u"},
 	{Opt_treelog, "treelog"},
@@ -461,6 +463,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
 			btrfs_set_opt(info->mount_opt, DEGRADED);
 			break;
 		case Opt_subvol:
+		case Opt_subvol_empty:
 		case Opt_subvolid:
 		case Opt_subvolrootid:
 		case Opt_device:
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: allow empty subvol= again
  2018-05-22  0:07 [PATCH] Btrfs: allow empty subvol= again Omar Sandoval
@ 2018-05-22  0:17 ` Omar Sandoval
  2018-05-22 10:50   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Omar Sandoval @ 2018-05-22  0:17 UTC (permalink / raw)
  To: linux-btrfs; +Cc: kernel-team, David Sterba, Tomohiro Misono

On Mon, May 21, 2018 at 05:07:19PM -0700, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> I got a report that after upgrading to 4.16, someone's filesystems
> weren't mounting:
> 
> [   23.845852] BTRFS info (device loop0): unrecognized mount option 'subvol='
> 
> Before 4.16, this mounted the default subvolume. It turns out that this
> empty "subvol=" is actually an application bug, but it was causing the
> application to fail, so it's an ABI break if you squint.
> 
> The generic parsing code we use for mount options (match_token())
> doesn't match an empty string as "%s". Previously, setup_root_args()
> removed the "subvol=" string, but the mount path was cleaned up to not
> need that. Add a dummy Opt_subvol_empty to fix this.
> 
> Fixes: 312c89fbca06 ("btrfs: cleanup btrfs_mount() using btrfs_mount_root()")
> Signed-off-by: Omar Sandoval <osandov@fb.com>
> ---
> Hi, Dave,
> 
> This is silly but IMO it's a regression. If you agree, this should
> probably go to 4.17 + stable. I'll submit an xfstests test shortly.
> 
> Thanks!

Update, we fixed the userspace bug now so I'd be fine if we dropped this
patch. I guess there's still a possibility that there are other users
that hit this, so I'll leave it up to you, Dave, whether it's important
enough to care.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: allow empty subvol= again
  2018-05-22  0:17 ` Omar Sandoval
@ 2018-05-22 10:50   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2018-05-22 10:50 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-btrfs, kernel-team, David Sterba, Tomohiro Misono

> > This is silly but IMO it's a regression. If you agree, this should
> > probably go to 4.17 + stable. I'll submit an xfstests test shortly.
> 
> Update, we fixed the userspace bug now so I'd be fine if we dropped this
> patch. I guess there's still a possibility that there are other users
> that hit this, so I'll leave it up to you, Dave, whether it's important
> enough to care.

The documentation does not say anything about the empty value of the
path, it's subvol=path, so I'm not sure if empty string is normally
considered a valid path.

I'll add the patch and update documentation, as it's a small issue, but
not really an urgent fix for 4.17. It also has a simple fix, to use / or
"." .

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-22 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22  0:07 [PATCH] Btrfs: allow empty subvol= again Omar Sandoval
2018-05-22  0:17 ` Omar Sandoval
2018-05-22 10:50   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.