* [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range @ 2016-12-25 13:31 Chandan Rajendra 2017-01-02 15:58 ` Jan Kara 2017-01-02 16:35 ` Jens Axboe 0 siblings, 2 replies; 5+ messages in thread From: Chandan Rajendra @ 2016-12-25 13:31 UTC (permalink / raw) To: axboe, jack; +Cc: Chandan Rajendra, linux-block, linux-fsdevel, linux-kernel 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> --- 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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range 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 2017-01-02 16:35 ` Jens Axboe 1 sibling, 1 reply; 5+ messages in thread From: Jan Kara @ 2017-01-02 15:58 UTC (permalink / raw) To: Chandan Rajendra; +Cc: axboe, jack, linux-block, linux-fsdevel, linux-kernel 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range 2017-01-02 15:58 ` Jan Kara @ 2017-01-02 16:21 ` Eryu Guan 2017-01-02 16:46 ` Jan Kara 0 siblings, 1 reply; 5+ messages in thread From: Eryu Guan @ 2017-01-02 16:21 UTC (permalink / raw) To: Jan Kara Cc: Chandan Rajendra, axboe, linux-block, linux-fsdevel, linux-kernel 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range 2017-01-02 16:21 ` Eryu Guan @ 2017-01-02 16:46 ` Jan Kara 0 siblings, 0 replies; 5+ messages in thread From: Jan Kara @ 2017-01-02 16:46 UTC (permalink / raw) To: Eryu Guan Cc: Jan Kara, Chandan Rajendra, axboe, linux-block, linux-fsdevel, linux-kernel On Tue 03-01-17 00:21:45, Eryu Guan wrote: > 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> Thanks! Yeah, I had run xfstests with those patches but not with blocksize < pagesize :-| Shit happens... need to be more careful next time. Honza > > 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 -- Jan Kara <jack@suse.com> SUSE Labs, CR ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range 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:35 ` Jens Axboe 1 sibling, 0 replies; 5+ messages in thread From: Jens Axboe @ 2017-01-02 16:35 UTC (permalink / raw) To: Chandan Rajendra, jack; +Cc: linux-block, linux-fsdevel, linux-kernel On 12/25/2016 06:31 AM, 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. Queued up, thanks. -- Jens Axboe ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-02 16:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 2017-01-02 16:46 ` Jan Kara 2017-01-02 16:35 ` Jens Axboe
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).