linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: John Stoffel <john@stoffel.org>
Cc: Shaohua Li <shli@kernel.org>, Song Liu <songliubraving@fb.com>,
	linux-raid <linux-raid@vger.kernel.org>,
	"kumba@gentoo.org" <kumba@gentoo.org>, Shaohua Li <shli@fb.com>
Subject: Re: [PATCH] md: forbid a RAID5 from having both a bitmap and a journal.
Date: Wed, 18 Oct 2017 08:03:55 +1100	[thread overview]
Message-ID: <8760bdjxl0.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <23014.27372.306872.143938@quad.stoffel.home>

[-- Attachment #1: Type: text/plain, Size: 3956 bytes --]

On Tue, Oct 17 2017, John Stoffel wrote:

>>>>>> "NeilBrown" == NeilBrown  <neilb@suse.com> writes:
>
> NeilBrown> Having both a bitmap and a journal is pointless.
> NeilBrown> Attempting to do so can corrupt the bitmap if the journal
> NeilBrown> replay happens before the bitmap is initialized.
> NeilBrown> Rather than try to avoid this corruption, simply
> NeilBrown> refuse to allow arrays with both a bitmap and a journal.
> NeilBrown> So:
> NeilBrown>  - if raid5_run sees both are present, fail.
>
> So what happens if there's someone out there with an array setup with
> both already?  Should the journal or the bitmap be removed at this
> time?  

If someone has an array like that they can assemble it with
  --update=no-bitmap

I'd rather not automatically disable things.

Thanks,
NeilBrown


>
> NeilBrown>  - if adding a bitmap finds a journal is present, fail
> NeilBrown>  - if adding a journal finds a bitmap is present, fail.
>
> NeilBrown> Cc: stable@vger.kernel.org (4.10+)
> NeilBrown> Signed-off-by: NeilBrown <neilb@suse.com>
> NeilBrown> ---
>
> NeilBrown> This patch should replace 8031c3ddc70ab, which should be reverted.
>
> NeilBrown> Thanks,
> NeilBrown> NeilBrown
>
>
> NeilBrown>  drivers/md/bitmap.c | 6 ++++++
> NeilBrown>  drivers/md/md.c     | 2 +-
> NeilBrown>  drivers/md/raid5.c  | 7 +++++++
> NeilBrown>  3 files changed, 14 insertions(+), 1 deletion(-)
>
> NeilBrown> diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
> NeilBrown> index cae57b5be817..f425905c97fa 100644
> NeilBrown> --- a/drivers/md/bitmap.c
> NeilBrown> +++ b/drivers/md/bitmap.c
> NeilBrown> @@ -1816,6 +1816,12 @@ struct bitmap *bitmap_create(struct mddev *mddev, int slot)
>  
> NeilBrown>  	BUG_ON(file && mddev->bitmap_info.offset);
>  
> NeilBrown> +	if (test_bit(MD_HAS_JOURNAL, &mddev->flags)) {
> NeilBrown> +		pr_notice("md/raid:%s: array with journal cannot have bitmap\n",
> NeilBrown> +			  mdname(mddev));
> NeilBrown> +		return ERR_PTR(-EBUSY);
> NeilBrown> +	}
> NeilBrown> +
> NeilBrown>  	bitmap = kzalloc(sizeof(*bitmap), GFP_KERNEL);
> NeilBrown>  	if (!bitmap)
> NeilBrown>  		return ERR_PTR(-ENOMEM);
> NeilBrown> diff --git a/drivers/md/md.c b/drivers/md/md.c
> NeilBrown> index 63ecfb063b76..bf06ff017eda 100644
> NeilBrown> --- a/drivers/md/md.c
> NeilBrown> +++ b/drivers/md/md.c
> NeilBrown> @@ -6384,7 +6384,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
> NeilBrown>  					break;
> NeilBrown>  				}
> NeilBrown>  			}
> NeilBrown> -			if (has_journal) {
> NeilBrown> +			if (has_journal || mddev->bitmap) {
> NeilBrown>  				export_rdev(rdev);
> NeilBrown>  				return -EBUSY;
> NeilBrown>  			}
> NeilBrown> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> NeilBrown> index 4f40ccd21cbb..e070e5c68801 100644
> NeilBrown> --- a/drivers/md/raid5.c
> NeilBrown> +++ b/drivers/md/raid5.c
> NeilBrown> @@ -7134,6 +7134,13 @@ static int raid5_run(struct mddev *mddev)
> NeilBrown>  			min_offset_diff = diff;
> NeilBrown>  	}
>  
> NeilBrown> +	if ((test_bit(MD_HAS_JOURNAL, &mddev->flags) || journal_dev) &&
> NeilBrown> +	    (mddev->bitmap_info.offset || mddev->bitmap_info.file)) {
> NeilBrown> +		pr_notice("md/raid:%s: array cannot have both journal and bitmap\n",
> NeilBrown> +			  mdname(mddev));
> NeilBrown> +		return -EINVAL;
> NeilBrown> +	}
> NeilBrown> +
> NeilBrown>  	if (mddev->reshape_position != MaxSector) {
> NeilBrown>  		/* Check that we can continue the reshape.
> NeilBrown>  		 * Difficulties arise if the stripe we would write to
> NeilBrown> -- 
> NeilBrown> 2.14.0.rc0.dirty
>
> NeilBrown> [DELETED ATTACHMENT signature.asc, application/pgp-signature]
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-10-17 21:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 21:20 [PATCH] md/bitmap: avoid read out of the disk Shaohua Li
2017-10-11 12:41 ` Joshua Kinard
2017-10-12  3:09 ` NeilBrown
2017-10-12 17:30   ` Shaohua Li
2017-10-12 17:53     ` Song Liu
2017-10-12 21:46       ` NeilBrown
2017-10-12 22:51         ` Shaohua Li
2017-10-13  5:16       ` NeilBrown
2017-10-13 19:51         ` Shaohua Li
2017-10-16 16:21           ` Song Liu
2017-10-16 21:15             ` NeilBrown
2017-10-16 23:56               ` Shaohua Li
2017-10-17  3:24                 ` [PATCH] md: forbid a RAID5 from having both a bitmap and a journal NeilBrown
2017-10-17 20:41                   ` John Stoffel
2017-10-17 21:03                     ` NeilBrown [this message]
2017-10-18  1:51                       ` Joshua Kinard
2017-10-19 23:16                         ` Wols Lists
2017-10-18 14:48                       ` John Stoffel
2017-10-19 23:21                         ` Wols Lists
2017-10-18  1:50                   ` Joshua Kinard
2017-10-19  3:16                   ` Shaohua Li
2017-10-12 21:44     ` [PATCH] md/bitmap: avoid read out of the disk NeilBrown

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=8760bdjxl0.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=john@stoffel.org \
    --cc=kumba@gentoo.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=shli@fb.com \
    --cc=shli@kernel.org \
    --cc=songliubraving@fb.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).