From patchwork Tue Mar 11 06:55:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrick Wong X-Patchwork-Id: 328943 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 61ECC2C00BD for ; Tue, 11 Mar 2014 17:55:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752982AbaCKGzI (ORCPT ); Tue, 11 Mar 2014 02:55:08 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:32283 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbaCKGzG (ORCPT ); Tue, 11 Mar 2014 02:55:06 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2B6t4iN004189 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Mar 2014 06:55:05 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2B6t3Pe011468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Mar 2014 06:55:04 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2B6t3TP000231; Tue, 11 Mar 2014 06:55:03 GMT Received: from localhost (/67.160.151.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Mar 2014 23:55:03 -0700 Subject: [PATCH 10/49] libext2fs: fix iblocks correctly when expanding an inline_data file To: tytso@mit.edu, darrick.wong@oracle.com From: "Darrick J. Wong" Cc: linux-ext4@vger.kernel.org Date: Mon, 10 Mar 2014 23:55:02 -0700 Message-ID: <20140311065502.30585.81788.stgit@birch.djwong.org> In-Reply-To: <20140311065356.30585.47192.stgit@birch.djwong.org> References: <20140311065356.30585.47192.stgit@birch.djwong.org> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org i_blocks covers the number of blocks allocated to an inode for data, extents, and ACL blocks. Since it's possible for a file to have a separate ACL block and inline data, we must be careful when expanding an inline data file to adjust, not set, the value of i_blocks. Signed-off-by: Darrick J. Wong --- lib/ext2fs/inline_data.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 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/lib/ext2fs/inline_data.c b/lib/ext2fs/inline_data.c index 72e8fa3..a9ec923 100644 --- a/lib/ext2fs/inline_data.c +++ b/lib/ext2fs/inline_data.c @@ -372,7 +372,9 @@ ext2fs_inline_data_dir_expand(ext2_filsys fs, ext2_ino_t ino, if (EXT2_HAS_INCOMPAT_FEATURE(fs->super, EXT3_FEATURE_INCOMPAT_EXTENTS)) inode->i_flags |= EXT4_EXTENTS_FL; inode->i_flags &= ~EXT4_INLINE_DATA_FL; - ext2fs_iblk_set(fs, inode, 1); + retval = ext2fs_iblk_add_blocks(fs, inode, 1); + if (retval) + goto errout; inode->i_size = fs->blocksize; retval = ext2fs_bmap2(fs, ino, inode, 0, BMAP_SET, 0, 0, &blk); if (retval) @@ -410,7 +412,6 @@ ext2fs_inline_data_file_expand(ext2_filsys fs, ext2_ino_t ino, inode->i_flags |= EXT4_EXTENTS_FL; } inode->i_flags &= ~EXT4_INLINE_DATA_FL; - ext2fs_iblk_set(fs, inode, 0); inode->i_size = 0; retval = ext2fs_write_inode(fs, ino, inode); if (retval)