public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Kazuya Mio <k-mio@sx.jp.nec.com>
To: ext4 <linux-ext4@vger.kernel.org>, Theodore Tso <tytso@mit.edu>
Subject: [PATCH] ext4: Fix max file size of extent format file
Date: Wed, 11 May 2011 17:08:38 +0900	[thread overview]
Message-ID: <4DCA4406.4030601@sx.jp.nec.com> (raw)

We hit BUG_ON in ext4_ext_put_gap_in_cache() while creating a file
whose size is the max file size of extent format. Because the extent cache
length is 0 when we allocate two blocks to the file offset 2^32-2, and then
the offset 2^32-1. To fix it, we decrease the max file size to
(2^32-2)*blocksize. In this way, we would be able to allocate a block up to
the offset 2^32-2. I think there is no data loss because we can read all files
created before applying this patch.

How to reproduce:
I'm running 2.6.39-rc6. Note that i386 architecture and 4KB blocksize cannot
reproduce this problem.

# dd if=/dev/zero of=/mnt/mp1/file bs=<blocksize> count=1 seek=$((2**32-2))
# sync
# dd if=/dev/zero of=/mnt/mp1/file bs=<blocksize> count=1 seek=$((2**32-1))

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
---
 fs/ext4/super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8553dfb..fce0249 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2248,8 +2248,8 @@ static loff_t ext4_max_size(int blkbits, int has_huge_files)
 
 	/* 32-bit extent-start container, ee_block */
 	res = 1LL << 32;
-	res <<= blkbits;
 	res -= 1;
+	res <<= blkbits;
 
 	/* Sanity check against vm- & vfs- imposed limits */
 	if (res > upper_limit)


             reply	other threads:[~2011-05-11 17:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  8:08 Kazuya Mio [this message]
2011-05-13  6:34 ` [PATCH] ext4: Fix max file size of extent format file Lukas Czerner
2011-05-13  6:36   ` [PATCH] ext4: invalidate gap cache when writing extents last block Lukas Czerner
2011-05-13  8:55     ` Kazuya Mio
2011-05-24  8:33       ` Kazuya Mio
2011-05-24  8:57         ` Lukas Czerner
2011-05-25  8:59           ` Kazuya Mio
2011-06-03 17:35   ` [PATCH] ext4: Fix max file size of extent format file Andreas Dilger
2011-06-03 18:08     ` Lukas Czerner

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=4DCA4406.4030601@sx.jp.nec.com \
    --to=k-mio@sx.jp.nec.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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