linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Cc: axboe@kernel.dk, jack@suse.cz, 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: Mon, 2 Jan 2017 16:58:03 +0100	[thread overview]
Message-ID: <20170102155803.GH18058@quack2.suse.cz> (raw)
In-Reply-To: <1482672663-17122-1-git-send-email-chandan@linux.vnet.ibm.com>

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?

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

  reply	other threads:[~2017-01-02 15:58 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 [this message]
2017-01-02 16:21   ` Eryu Guan
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=20170102155803.GH18058@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=axboe@kernel.dk \
    --cc=chandan@linux.vnet.ibm.com \
    --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).