From: Eryu Guan <guaneryu@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: Chandan Rajendra <chandan@linux.vnet.ibm.com>,
axboe@kernel.dk, linux-block@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range
Date: Tue, 3 Jan 2017 00:21:45 +0800 [thread overview]
Message-ID: <20170102162145.GA1946@eguan.usersys.redhat.com> (raw)
In-Reply-To: <20170102155803.GH18058@quack2.suse.cz>
On Mon, Jan 02, 2017 at 04:58:03PM +0100, Jan Kara wrote:
> On Sun 25-12-16 19:01:03, Chandan Rajendra wrote:
> > The first block to be cleaned may start at a non-zero page offset. In
> > such a scenario clean_bdev_aliases() will end up cleaning blocks that
> > do not fall in the range of blocks to be cleaned. This commit fixes the
> > issue by skipping blocks that do not fall in valid block range.
> >
> > Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
>
> Ah, very good catch! How did you spot this?
I failed to notice this patch, and I came up with a same patch today
myself, and I'm still testing it.
I found this by xfstests, many tests (tens of tests) failed fsck after
test when testing extN if blocksize < pagesize. E.g. generic/013 could
reproduce the fs corruption quite reliablely for me.
Reviewed-by: Eryu Guan <eguan@redhat.com>
>
> The patch looks good. You can add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
>
> Jens, please merge this fix quickly as we may end up discarding changes to
> innocent metadata blocks due to this... Thanks!
>
> Honza
> > ---
> > fs/buffer.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/buffer.c b/fs/buffer.c
> > index 1df2bd5..28484b3 100644
> > --- a/fs/buffer.c
> > +++ b/fs/buffer.c
> > @@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
> > head = page_buffers(page);
> > bh = head;
> > do {
> > - if (!buffer_mapped(bh))
> > + if (!buffer_mapped(bh) || (bh->b_blocknr < block))
> > goto next;
> > if (bh->b_blocknr >= block + len)
> > break;
> > --
> > 2.5.5
> >
> --
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
> --
> To unsubscribe from this list: send the line "unsubscribe linux-block" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-01-02 16:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-25 13:31 [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range Chandan Rajendra
2017-01-02 15:58 ` Jan Kara
2017-01-02 16:21 ` Eryu Guan [this message]
2017-01-02 16:46 ` Jan Kara
2017-01-02 16:35 ` Jens Axboe
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=20170102162145.GA1946@eguan.usersys.redhat.com \
--to=guaneryu@gmail.com \
--cc=axboe@kernel.dk \
--cc=chandan@linux.vnet.ibm.com \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).