From patchwork Wed May 11 08:08:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuya Mio X-Patchwork-Id: 95171 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 05BFCB6F7D for ; Thu, 12 May 2011 03:26:40 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522Ab1EKR0a (ORCPT ); Wed, 11 May 2011 13:26:30 -0400 Received: from TYO200.gate.nec.co.jp ([202.32.8.215]:59910 "EHLO tyo200.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169Ab1EKR03 (ORCPT ); Wed, 11 May 2011 13:26:29 -0400 X-Greylist: delayed 969 seconds by postgrey-1.27 at vger.kernel.org; Wed, 11 May 2011 13:26:29 EDT Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id p4B8FT0g003723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 11 May 2011 17:15:29 +0900 (JST) Received: from mailgate3.nec.co.jp ([10.7.69.193]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id p4B89NC9001432; Wed, 11 May 2011 17:09:23 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id p4B89NB18559; Wed, 11 May 2011 17:09:23 +0900 (JST) Received: from mail03.kamome.nec.co.jp (mail03.kamome.nec.co.jp [10.25.43.7]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id p4B88bo0013854; Wed, 11 May 2011 17:09:22 +0900 (JST) Received: from shikibu.jp.nec.com ([10.26.220.2] [10.26.220.2]) by mail02.kamome.nec.co.jp with ESMTP id BT-MMP-921466; Wed, 11 May 2011 17:08:39 +0900 Received: from [10.64.168.30] ([10.64.168.30] [10.64.168.30]) by mail.jp.nec.com with ESMTP; Wed, 11 May 2011 17:08:38 +0900 Message-ID: <4DCA4406.4030601@sx.jp.nec.com> Date: Wed, 11 May 2011 17:08:38 +0900 From: Kazuya Mio User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: ext4 , Theodore Tso Subject: [PATCH] ext4: Fix max file size of extent format file Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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= count=1 seek=$((2**32-2)) # sync # dd if=/dev/zero of=/mnt/mp1/file bs= count=1 seek=$((2**32-1)) Signed-off-by: Kazuya Mio --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)