public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] block: fix off-by-one in init_page_buffers
@ 2012-06-20 18:01 Jeff Moyer
  2012-06-21 15:45 ` Ben Hutchings
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Moyer @ 2012-06-20 18:01 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel; +Cc: stable, torsten.hilbrich, Nick Piggin

Hi,

This commit:

commit 080399aaaf3531f5b8761ec0ac30ff98891e8686
Author: Jeff Moyer <jmoyer@redhat.com>
Date:   Fri May 11 16:34:10 2012 +0200

    block: don't mark buffers beyond end of disk as mapped

introduced a bug whereby the last block on the device was treated as
beyond the end of the device.  This causes the mount program to hang
when trying to (erroneously) mount an extended partition, as reported by
Torsten Hilbrich here: https://lkml.org/lkml/2012/6/18/54, and also
reported independently here:
http://www.sysresccd.org/forums/viewtopic.php?f=13&t=4511.

The attached patch was tested by myself and Torsten and found to resolve
the problem.  I also instrumented the init_page_buffers routine to
ensure that the end_block is indeed the last block of the device.

Comments, as always, are appreciated.

--

This needs backporting to the stable trees where the offending commit
was backported.  I'm sure that includes 3.0 and 3.3, but not sure where
else it was committed.  Is there an easy way to tell what trees got the
commit?

CC: stable@vger.kernel.org, npiggin@kernel.dk
Reported-and-Tested-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/fs/buffer.c b/fs/buffer.c
index 838a9cf..769b30b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -930,7 +930,7 @@ init_page_buffers(struct page *page, struct block_device *bdev,
 			bh->b_blocknr = block;
 			if (uptodate)
 				set_buffer_uptodate(bh);
-			if (block < end_block)
+			if (block <= end_block)
 				set_buffer_mapped(bh);
 		}
 		block++;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] block: fix off-by-one in init_page_buffers
  2012-06-20 18:01 [patch] block: fix off-by-one in init_page_buffers Jeff Moyer
@ 2012-06-21 15:45 ` Ben Hutchings
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2012-06-21 15:45 UTC (permalink / raw)
  To: Jeff Moyer
  Cc: Jens Axboe, linux-kernel, stable, torsten.hilbrich, Nick Piggin

On Wed, Jun 20, 2012 at 02:01:28PM -0400, Jeff Moyer wrote:
[...]
> This needs backporting to the stable trees where the offending commit
> was backported.  I'm sure that includes 3.0 and 3.3, but not sure where
> else it was committed.

3.2 as well.

> Is there an easy way to tell what trees got the commit?
[...]

I don't know about easy, but if you have 'stable' as a remote then
this works:

$ git branch -r | sed 's/^ *stable\/linux-\([0-9.]*\)\.y/\1/; t; d' | while read version; do git rev-list --grep=080399aaaf3531f5b8761ec0ac30ff98891e8686 v$version..stable/linux-$version.y | grep -q . && echo $version; done
3.0
3.2
3.3

(Maybe I'll wrap that up in a script.)
 
Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-21 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20 18:01 [patch] block: fix off-by-one in init_page_buffers Jeff Moyer
2012-06-21 15:45 ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox