From patchwork Thu Sep 12 14:21:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niu Yawei X-Patchwork-Id: 274561 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 2F4EC2C03AE for ; Fri, 13 Sep 2013 00:21:55 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753703Ab3ILOVy (ORCPT ); Thu, 12 Sep 2013 10:21:54 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:56030 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752029Ab3ILOVx (ORCPT ); Thu, 12 Sep 2013 10:21:53 -0400 Received: by mail-pb0-f54.google.com with SMTP id ro12so10614719pbb.13 for ; Thu, 12 Sep 2013 07:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=vYFqGGRKyCrrg095+S/LlE0E9lSyJYln7g7jZhFgjLo=; b=r0Hh44iWt4cL8y4cBPbIPCJZ6at14gkYUZqso4Un8NhQ+wdt+f8KssCC0QIxo0s/b2 Si+nXYtD8vgs0E0p4IOhx5eQuLG/YDdSTCiOgfsrn9sX2EintPK9cIl7dS5c4ij40paK B29wr78oQMGk3hpxK7UvqnBGP7SCUSrJzVeDTbP2gWjOGMnydZ0AodhYOenWu1x8+ysI H2zZaYfN5lWx9GNN+02AM4AX4q0RIkALreCkiLRLsR4UwD3F5POzNt1CY4LEBUI3r054 DoKDS0t4qqw3D9n6zqDsvvufp9r5/Ds3kr6ZjEXm6eppVZ7UlLt185xzjyRTQ+AAuBcM GgEw== X-Received: by 10.68.245.227 with SMTP id xr3mr1778900pbc.182.1378995712958; Thu, 12 Sep 2013 07:21:52 -0700 (PDT) Received: from [10.0.0.101] ([222.211.223.61]) by mx.google.com with ESMTPSA id lm2sm11179852pab.2.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Sep 2013 07:21:52 -0700 (PDT) Message-ID: <5231CDFE.8050206@gmail.com> Date: Thu, 12 Sep 2013 22:21:50 +0800 From: Niu Yawei User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: adityakali@google.com, tytso@mit.edu CC: linux-ext4@vger.kernel.org, yawei.niu@intel.com Subject: [PATCH] tune2fs: update i_size in ext2fs_file_write() Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ext2fs_file_write() needs to update i_size on successful write, otherwise, ext2fs_file_read() in same open/close cycle will not be able to read the just written data. Which result in the the problem of quotacheck triggered on 'tune2fs -O quota' failed to write back multiple users/groups accounting information. Signed-off-by: Niu Yawei --- lib/ext2fs/fileio.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) fail: diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c index 1f7002c..b1b5540 100644 --- a/lib/ext2fs/fileio.c +++ b/lib/ext2fs/fileio.c @@ -304,6 +304,13 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, ptr += c; count += c; nbytes -= c; + + /* Update inode size */ + if (EXT2_I_SIZE(&file->inode) < file->pos) { + retval = ext2fs_file_set_size2(file, file->pos); + if (retval) + goto fail; + } }