mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cox, Alan" <alan.cox@intel.com>
To: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"aeb@cwi.nl" <aeb@cwi.nl>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Cannot partition 32GB disk on a 32bit machine (correct version of the patch this time)
Date: Thu, 19 Jun 2014 09:33:26 +0000	[thread overview]
Message-ID: <1403170400.10778.38.camel@acox1-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1403170201.10778.36.camel@acox1-desk.ger.corp.intel.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2127 bytes --]

On Thu, 2014-06-19 at 10:30 +0100, Alan Cox wrote:
> The block code has 32bit cleanness problems with the iterator. This
> prevents things like partitioning a 32GB volume on a 32bit system.
> 
> I hit this with a volume of exactly 32GB in size (easy to duplicate with
> virtual machines). Tracing at step by step through the kernel I found
> the problem lines in blkdev_read_iter which truncates the size value
> into a 32bit value when setting up the iterator.
> 
> The hack below if applied "fixes" this and I think demonstrates that
> this is the problem spot.
> 
> What I'm less clear on is what the correct fix for this should be.

block: fix inability to partition large volumes

From: Alan <alan@linux.intel.com>

The block code has 32bit cleanness problems with the iterator. This
prevents things like partitioning a 32GB volume on a 32bit system.

This is a simple initial "fix" that clips the problem cases so get
behaviour that is at least sane and trivially backportable.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---
 fs/block_dev.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6d72746..bef2414 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1603,6 +1603,9 @@ static ssize_t blkdev_read_iter(struct kiocb
*iocb, struct iov_iter *to)
 
 	size -= pos;
 	iov_iter_truncate(to, size);
+	/* Fix up for 32bit boxes for now */
+	if (to->count < size)
+	        to->count = 0xFFFFFFFF;
 	return generic_file_read_iter(iocb, to);
 }
 

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2014-06-19  9:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19  9:30 Cannot partition 32GB disk on a 32bit machine Alan Cox
2014-06-19  9:33 ` Cox, Alan [this message]
2014-06-19 18:43   ` Cannot partition 32GB disk on a 32bit machine (correct version of the patch this time) James Bottomley
2014-06-19 20:51     ` Andrew Morton
2014-06-19 21:12     ` Paul Bolle
2014-06-19 23:04     ` Alan Cox
2014-06-19 23:44       ` James Bottomley
2014-06-19 21:12   ` Andries E. Brouwer

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=1403170400.10778.38.camel@acox1-desk.ger.corp.intel.com \
    --to=alan.cox@intel.com \
    --cc=aeb@cwi.nl \
    --cc=akpm@linux-foundation.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

all inboxes | Powered by JetHome®