mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Jens Axboe <jaxboe@fusionio.com>, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, torsten.hilbrich@secunet.com,
	Nick Piggin <npiggin@kernel.dk>
Subject: [patch] block: fix off-by-one in init_page_buffers
Date: Wed, 20 Jun 2012 14:01:28 -0400	[thread overview]
Message-ID: <x49txy5yi9z.fsf@segfault.boston.devel.redhat.com> (raw)

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++;

             reply	other threads:[~2012-06-20 18:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 18:01 Jeff Moyer [this message]
2012-06-21 15:45 ` Ben Hutchings

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=x49txy5yi9z.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@kernel.dk \
    --cc=stable@vger.kernel.org \
    --cc=torsten.hilbrich@secunet.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

all inboxes | Powered by JetHome®