diff mbox series

[SRU,N] btrfs: re-introduce 'norecovery' mount option

Message ID 20240606092034.16613-1-roxana.nicolescu@canonical.com
State New
Headers show
Series [SRU,N] btrfs: re-introduce 'norecovery' mount option | expand

Commit Message

Roxana Nicolescu June 6, 2024, 9:20 a.m. UTC
From: Qu Wenruo <wqu@suse.com>

BugLink: https://bugs.launchpad.net/bugs/2068591

Although 'norecovery' mount option was marked as deprecated for a long
time and a warning message was printed during the deprecation window,
it's still actively utilized by several projects that need a safer way
to mount a btrfs without any writes.

Furthermore this 'norecovery' mount option is supported by other major
filesystems, which makes it less clear what's our motivation to remove
it.

Re-introduce the 'norecovery' mount option, and output a message to recommend
'rescue=nologreplay' option.

Link: https://lore.kernel.org/linux-btrfs/ZkxZT0J-z0GYvfy8@gardel-login/#t
Link: https://github.com/systemd/systemd/pull/32892
Link: https://bugzilla.suse.com/show_bug.cgi?id=1222429
Reported-by: Lennart Poettering <lennart@poettering.net>
Reported-by: Jiri Slaby <jslaby@suse.com>
Fixes: a1912f712188 ("btrfs: remove code for inode_cache and recovery mount options")
CC: stable@vger.kernel.org # 6.8+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
(cherry picked from commit 440861b1a03c72cc7be4a307e178dcaa6894479b)
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
---
 fs/btrfs/super.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Stefan Bader June 6, 2024, 9:26 a.m. UTC | #1
On 06.06.24 11:20, Roxana Nicolescu wrote:
> From: Qu Wenruo <wqu@suse.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2068591
> 
> Although 'norecovery' mount option was marked as deprecated for a long
> time and a warning message was printed during the deprecation window,
> it's still actively utilized by several projects that need a safer way
> to mount a btrfs without any writes.
> 
> Furthermore this 'norecovery' mount option is supported by other major
> filesystems, which makes it less clear what's our motivation to remove
> it.
> 
> Re-introduce the 'norecovery' mount option, and output a message to recommend
> 'rescue=nologreplay' option.
> 
> Link: https://lore.kernel.org/linux-btrfs/ZkxZT0J-z0GYvfy8@gardel-login/#t
> Link: https://github.com/systemd/systemd/pull/32892
> Link: https://bugzilla.suse.com/show_bug.cgi?id=1222429
> Reported-by: Lennart Poettering <lennart@poettering.net>
> Reported-by: Jiri Slaby <jslaby@suse.com>
> Fixes: a1912f712188 ("btrfs: remove code for inode_cache and recovery mount options")
> CC: stable@vger.kernel.org # 6.8+
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> Reviewed-by: David Sterba <dsterba@suse.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> (cherry picked from commit 440861b1a03c72cc7be4a307e178dcaa6894479b)
> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>   fs/btrfs/super.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index c45fdaf24cd1..8f171616159e 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -121,6 +121,7 @@ enum {
>   	Opt_thread_pool,
>   	Opt_treelog,
>   	Opt_user_subvol_rm_allowed,
> +	Opt_norecovery,
>   
>   	/* Rescue options */
>   	Opt_rescue,
> @@ -247,6 +248,8 @@ static const struct fs_parameter_spec btrfs_fs_parameters[] = {
>   	__fsparam(NULL, "nologreplay", Opt_nologreplay, fs_param_deprecated, NULL),
>   	/* Deprecated, with alias rescue=usebackuproot */
>   	__fsparam(NULL, "usebackuproot", Opt_usebackuproot, fs_param_deprecated, NULL),
> +	/* For compatibility only, alias for "rescue=nologreplay". */
> +	fsparam_flag("norecovery", Opt_norecovery),
>   
>   	/* Debugging options. */
>   	fsparam_flag_no("enospc_debug", Opt_enospc_debug),
> @@ -440,6 +443,11 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
>   		"'nologreplay' is deprecated, use 'rescue=nologreplay' instead");
>   		btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
>   		break;
> +	case Opt_norecovery:
> +		btrfs_info(NULL,
> +"'norecovery' is for compatibility only, recommended to use 'rescue=nologreplay'");
> +		btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
> +		break;
>   	case Opt_flushoncommit:
>   		if (result.negated)
>   			btrfs_clear_opt(ctx->mount_opt, FLUSHONCOMMIT);
Paolo Pisati June 6, 2024, 9:30 a.m. UTC | #2
On Thu, Jun 06, 2024 at 11:20:34AM +0200, Roxana Nicolescu wrote:
> From: Qu Wenruo <wqu@suse.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2068591

Clean upstream cherry-pick.

Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Stefan Bader June 6, 2024, 9:57 a.m. UTC | #3
On 06.06.24 11:20, Roxana Nicolescu wrote:
> From: Qu Wenruo <wqu@suse.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2068591
> 
> Although 'norecovery' mount option was marked as deprecated for a long
> time and a warning message was printed during the deprecation window,
> it's still actively utilized by several projects that need a safer way
> to mount a btrfs without any writes.
> 
> Furthermore this 'norecovery' mount option is supported by other major
> filesystems, which makes it less clear what's our motivation to remove
> it.
> 
> Re-introduce the 'norecovery' mount option, and output a message to recommend
> 'rescue=nologreplay' option.
> 
> Link: https://lore.kernel.org/linux-btrfs/ZkxZT0J-z0GYvfy8@gardel-login/#t
> Link: https://github.com/systemd/systemd/pull/32892
> Link: https://bugzilla.suse.com/show_bug.cgi?id=1222429
> Reported-by: Lennart Poettering <lennart@poettering.net>
> Reported-by: Jiri Slaby <jslaby@suse.com>
> Fixes: a1912f712188 ("btrfs: remove code for inode_cache and recovery mount options")
> CC: stable@vger.kernel.org # 6.8+
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> Reviewed-by: David Sterba <dsterba@suse.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> (cherry picked from commit 440861b1a03c72cc7be4a307e178dcaa6894479b)
> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
> ---

Applied to noble:linux/master-next. Thanks.

-Stefan

>   fs/btrfs/super.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index c45fdaf24cd1..8f171616159e 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -121,6 +121,7 @@ enum {
>   	Opt_thread_pool,
>   	Opt_treelog,
>   	Opt_user_subvol_rm_allowed,
> +	Opt_norecovery,
>   
>   	/* Rescue options */
>   	Opt_rescue,
> @@ -247,6 +248,8 @@ static const struct fs_parameter_spec btrfs_fs_parameters[] = {
>   	__fsparam(NULL, "nologreplay", Opt_nologreplay, fs_param_deprecated, NULL),
>   	/* Deprecated, with alias rescue=usebackuproot */
>   	__fsparam(NULL, "usebackuproot", Opt_usebackuproot, fs_param_deprecated, NULL),
> +	/* For compatibility only, alias for "rescue=nologreplay". */
> +	fsparam_flag("norecovery", Opt_norecovery),
>   
>   	/* Debugging options. */
>   	fsparam_flag_no("enospc_debug", Opt_enospc_debug),
> @@ -440,6 +443,11 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
>   		"'nologreplay' is deprecated, use 'rescue=nologreplay' instead");
>   		btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
>   		break;
> +	case Opt_norecovery:
> +		btrfs_info(NULL,
> +"'norecovery' is for compatibility only, recommended to use 'rescue=nologreplay'");
> +		btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
> +		break;
>   	case Opt_flushoncommit:
>   		if (result.negated)
>   			btrfs_clear_opt(ctx->mount_opt, FLUSHONCOMMIT);
diff mbox series

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index c45fdaf24cd1..8f171616159e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -121,6 +121,7 @@  enum {
 	Opt_thread_pool,
 	Opt_treelog,
 	Opt_user_subvol_rm_allowed,
+	Opt_norecovery,
 
 	/* Rescue options */
 	Opt_rescue,
@@ -247,6 +248,8 @@  static const struct fs_parameter_spec btrfs_fs_parameters[] = {
 	__fsparam(NULL, "nologreplay", Opt_nologreplay, fs_param_deprecated, NULL),
 	/* Deprecated, with alias rescue=usebackuproot */
 	__fsparam(NULL, "usebackuproot", Opt_usebackuproot, fs_param_deprecated, NULL),
+	/* For compatibility only, alias for "rescue=nologreplay". */
+	fsparam_flag("norecovery", Opt_norecovery),
 
 	/* Debugging options. */
 	fsparam_flag_no("enospc_debug", Opt_enospc_debug),
@@ -440,6 +443,11 @@  static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		"'nologreplay' is deprecated, use 'rescue=nologreplay' instead");
 		btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
 		break;
+	case Opt_norecovery:
+		btrfs_info(NULL,
+"'norecovery' is for compatibility only, recommended to use 'rescue=nologreplay'");
+		btrfs_set_opt(ctx->mount_opt, NOLOGREPLAY);
+		break;
 	case Opt_flushoncommit:
 		if (result.negated)
 			btrfs_clear_opt(ctx->mount_opt, FLUSHONCOMMIT);