From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>,
linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 1/5] btrfs: unify the ro checking for mount options
Date: Fri, 25 Sep 2020 08:36:13 +0800 [thread overview]
Message-ID: <fad6a957-c1ad-60c8-c6d6-d66f506fc9fe@gmx.com> (raw)
In-Reply-To: <d307f1d95415232dabfb700e79cda73618aa7d50.1600961206.git.josef@toxicpanda.com>
[-- Attachment #1.1: Type: text/plain, Size: 1744 bytes --]
On 2020/9/24 下午11:32, Josef Bacik wrote:
> We're going to be adding more options that require RDONLY, so add a
> helper to do the check and error out if we don't have RDONLY set.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/super.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 8840a4fa81eb..f99e89ec46b2 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -458,6 +458,17 @@ static const match_table_t rescue_tokens = {
> {Opt_err, NULL},
> };
>
> +static bool check_ro_option(struct btrfs_fs_info *fs_info, unsigned long opt,
> + const char *opt_name)
> +{
> + if (fs_info->mount_opt & opt) {
> + btrfs_err(fs_info, "%s must be used with ro mount option",
> + opt_name);
> + return true;
> + }
> + return false;
> +}
> +
> static int parse_rescue_options(struct btrfs_fs_info *info, const char *options)
> {
> char *opts;
> @@ -968,14 +979,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
> }
> }
> check:
> - /*
> - * Extra check for current option against current flag
> - */
> - if (btrfs_test_opt(info, NOLOGREPLAY) && !(new_flags & SB_RDONLY)) {
> - btrfs_err(info,
> - "nologreplay must be used with ro mount option");
> + /* We're read-only, don't have to check. */
> + if (new_flags & SB_RDONLY)
> + goto out;
> +
> + if (check_ro_option(info, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay"))
> ret = -EINVAL;
> - }
> out:
> if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE) &&
> !btrfs_test_opt(info, FREE_SPACE_TREE) &&
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-09-25 0:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 15:32 [PATCH 0/5] New rescue mount options Josef Bacik
2020-09-24 15:32 ` [PATCH 1/5] btrfs: unify the ro checking for " Josef Bacik
2020-09-25 0:36 ` Qu Wenruo [this message]
2020-09-28 12:37 ` Johannes Thumshirn
2020-09-28 18:23 ` Josef Bacik
2020-09-29 6:36 ` Johannes Thumshirn
2020-09-24 15:32 ` [PATCH 2/5] btrfs: push the NODATASUM check into btrfs_lookup_bio_sums Josef Bacik
2020-09-25 0:39 ` Qu Wenruo
2020-09-28 18:28 ` Josef Bacik
2020-09-28 12:39 ` Johannes Thumshirn
2020-09-24 15:32 ` [PATCH 3/5] btrfs: introduce rescue=ignorebadroots Josef Bacik
2020-09-25 0:47 ` Qu Wenruo
2020-09-28 18:24 ` Josef Bacik
2020-09-24 15:32 ` [PATCH 4/5] btrfs: introduce rescue=ignoredatacsums Josef Bacik
2020-09-25 0:50 ` Qu Wenruo
2020-09-24 15:32 ` [PATCH 5/5] btrfs: introduce rescue=all Josef Bacik
2020-09-25 0:51 ` Qu Wenruo
2020-09-25 0:34 ` [PATCH 0/5] New rescue mount options Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fad6a957-c1ad-60c8-c6d6-d66f506fc9fe@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox