linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Anand Jain <anand.jain@oracle.com>, linux-btrfs@vger.kernel.org
Cc: wqu@suse.com
Subject: Re: [PATCH v2 1/2] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
Date: Mon, 8 Jan 2018 13:08:33 +0800	[thread overview]
Message-ID: <dffaa3c8-30d9-2ec0-4fac-3bb6457c7136@gmx.com> (raw)
In-Reply-To: <20180108050409.727-1-anand.jain@oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 2333 bytes --]



On 2018年01月08日 13:04, Anand Jain wrote:
> Userland sets SUPER_FLAG_CHANGING_FSID and resets it only when changing
> fsid is complete. Its not a good idea to mount the device anything in
> between, so this patch fails the mount if SB SUPER_FLAG_CHANGING_FSID
> is set.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>   cc: wqu@suse.com
> ---
> v1->v2: Oops. Fix cut and paste error, remove ~. My bad.
> 
>  fs/btrfs/disk-io.c              | 7 ++++++-
>  include/uapi/linux/btrfs_tree.h | 1 +
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index a69e5944dc08..0dd215258ff9 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -61,7 +61,8 @@
>  				 BTRFS_HEADER_FLAG_RELOC |\
>  				 BTRFS_SUPER_FLAG_ERROR |\
>  				 BTRFS_SUPER_FLAG_SEEDING |\
> -				 BTRFS_SUPER_FLAG_METADUMP)
> +				 BTRFS_SUPER_FLAG_METADUMP |\
> +				 BTRFS_SUPER_FLAG_CHANGING_FSID)

Still the same problem here.

Since that super flag is excluded in btrfs_check_super_valid(), I didn't
see any meaning including it into BTRFS_SUPER_FLAG_SUPP, and it will
confuse later BTRFS_SUPER_FLAG_SUPP users.

Thanks,
Qu

>  
>  static const struct extent_io_ops btree_extent_io_ops;
>  static void end_workqueue_fn(struct btrfs_work *work);
> @@ -3906,6 +3907,10 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info)
>  		btrfs_err(fs_info, "no valid FS found");
>  		ret = -EINVAL;
>  	}
> +	if (btrfs_super_flags(sb) & BTRFS_SUPER_FLAG_CHANGING_FSID) {
> +		btrfs_err(fs_info, "SUPER_FLAG_CHANGING_FSID is set");
> +		ret = -EINVAL;
> +	}
>  	if (btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP)
>  		btrfs_warn(fs_info, "unrecognized super flag: %llu",
>  				btrfs_super_flags(sb) & ~BTRFS_SUPER_FLAG_SUPP);
> diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
> index 38ab0e06259a..aff1356c2bb8 100644
> --- a/include/uapi/linux/btrfs_tree.h
> +++ b/include/uapi/linux/btrfs_tree.h
> @@ -457,6 +457,7 @@ struct btrfs_free_space_header {
>  #define BTRFS_SUPER_FLAG_SEEDING	(1ULL << 32)
>  #define BTRFS_SUPER_FLAG_METADUMP	(1ULL << 33)
>  #define BTRFS_SUPER_FLAG_METADUMP_V2	(1ULL << 34)
> +#define BTRFS_SUPER_FLAG_CHANGING_FSID	(1ULL << 35)
>  
>  
>  /*
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

  reply	other threads:[~2018-01-08  5:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08  3:05 [PATCH 1/2] btrfs: add missing BTRFS_SUPER_FLAG define Anand Jain
2018-01-08  3:05 ` [PATCH 2/2] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko Anand Jain
2018-01-08  4:55   ` Qu Wenruo
2018-01-08  5:05     ` Anand Jain
2018-01-08  5:10     ` Anand Jain
2018-01-08  5:04   ` [PATCH v2 1/2] " Anand Jain
2018-01-08  5:08     ` Qu Wenruo [this message]
2018-01-08  5:13       ` Anand Jain
2018-01-08  5:25         ` Qu Wenruo
2018-01-08  5:58           ` Anand Jain
2018-01-08  7:50             ` Qu Wenruo
2018-01-08  4:52 ` [PATCH 1/2] btrfs: add missing BTRFS_SUPER_FLAG define 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=dffaa3c8-30d9-2ec0-4fac-3bb6457c7136@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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;
as well as URLs for NNTP newsgroup(s).