From: Shaohua Li <shli@kernel.org>
To: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Cc: shli@fb.com, songliubraving@fb.com, linux-raid@vger.kernel.org,
liuzhengyuang521@gmail.com
Subject: Re: [PATCH] md/raid5: write an empty meta-block when creating log super-block
Date: Mon, 24 Oct 2016 14:23:45 -0700 [thread overview]
Message-ID: <20161024212345.dehpl26uweujlmsl@kernel.org> (raw)
In-Reply-To: <1477296959-20123-1-git-send-email-liuzhengyuan@kylinos.cn>
On Mon, Oct 24, 2016 at 04:15:59PM +0800, Zhengyuan Liu wrote:
> If superblock points to an invalid meta block, r5l_load_log will set
> create_super with true and create an new superblock, this runtime path
> would always happen if we do no writing I/O to this array since it was
> created. Writing an empty meta block could avoid this unnecessary
> action at the first time we created log superblock.
>
> Another reason is for the corretness of log recovery. Currently we have
> bellow code to guarantee log revocery to be correct.
>
> if (ctx.seq > log->last_cp_seq + 1) {
> int ret;
>
> ret = r5l_log_write_empty_meta_block(log, ctx.pos, ctx.seq + 10);
> if (ret)
> return ret;
> log->seq = ctx.seq + 11;
> log->log_start = r5l_ring_add(log, ctx.pos, BLOCK_SECTORS);
> r5l_write_super(log, ctx.pos);
> } else {
> log->log_start = ctx.pos;
> log->seq = ctx.seq;
> }
>
> If we just created a array with a journal device, log->log_start and
> log->last_checkpoint should all be 0, then we write three meta block
> which are valid except mid one and supposed crash happened. The ctx.seq
> would equal to log->last_cp_seq + 1 and log->log_start would be set to
> position of mid invalid meta block after we did a recovery, this will
> lead to problems which could be avoided with this patch.
This would be very unlikely, but better to fix. Applied, thanks!
prev parent reply other threads:[~2016-10-24 21:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 8:15 [PATCH] md/raid5: write an empty meta-block when creating log super-block Zhengyuan Liu
2016-10-24 21:23 ` Shaohua Li [this message]
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=20161024212345.dehpl26uweujlmsl@kernel.org \
--to=shli@kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=liuzhengyuan@kylinos.cn \
--cc=liuzhengyuang521@gmail.com \
--cc=shli@fb.com \
--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