From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id p8JLj9Yj016299 for ; Mon, 19 Sep 2011 16:45:09 -0500 Received: from mx1.redhat.com (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 4215415B999 for ; Mon, 19 Sep 2011 14:45:08 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id tOy9d1gXssOGvonR for ; Mon, 19 Sep 2011 14:45:08 -0700 (PDT) Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8JLj70x017186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 19 Sep 2011 17:45:07 -0400 Message-ID: <4E77B7E2.6020805@redhat.com> Date: Mon, 19 Sep 2011 16:45:06 -0500 From: Eric Sandeen MIME-Version: 1.0 Subject: [PATCH] mkfs.xfs: don't increase agblocks past maximum List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: xfs-bounces@oss.sgi.com Errors-To: xfs-bounces@oss.sgi.com To: xfs-oss Cc: Boris Ranto RH QA discovered this bug: Steps to Reproduce: 1. Create 4 TB - 1 B partition dd if=/dev/zero of=x.img bs=1 count=0 seek=4398046511103 2. Create xfs fs with 512 B block size on the partition mkfs.xfs -b size=512 xfs.img Actual results: Agsize is computed incorrectly resulting in fs creation fail: agsize (2147483648b) too big, maximum is 2147483647 blocks This is due to the "rounding up" at the very end of the calculations; there may be other places to alleviate the problem, but it seems most obvious to simply skip the rounding up if it would create too many blocks in the AG. Worst case, we lose 1 block per AG. Signed-off-by: Eric Sandeen --- diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 5b3b9a7..856a261 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -658,7 +659,9 @@ calc_default_ag_geometry( * last bit of the filesystem. The same principle applies * to the AG count, so we don't lose the last AG! */ - blocks = (dblocks >> shift) + ((dblocks & xfs_mask32lo(shift)) != 0); + blocks = (dblocks >> shift); + if (blocks < XFS_AG_MAX_BLOCKS(blocklog)) + blocks += ((dblocks & xfs_mask32lo(shift)) != 0); done: *agsize = blocks; _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs