Received: by 10.213.65.68 with SMTP id h4csp2153053imn; Sun, 8 Apr 2018 21:04:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx48lHVnwrqvWBzvLrZgJCvTh1hyvSlIlxlMqaETV5xZMRqlgCFxVxKnhQEZ6h6QVESbfoZQa X-Received: by 2002:a17:902:9a81:: with SMTP id w1-v6mr36583064plp.148.1523246695435; Sun, 08 Apr 2018 21:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523246695; cv=none; d=google.com; s=arc-20160816; b=FEVv3mMVcU2Jnvvgk1do50Vbrx0yHbWQ5ohZtxYkE8KLAO8B2K+Z24XiI1fv69QJ4t xQ74yQcFg2nRhCqd3MB/81tO/iM3C6Dol4ONP74oqTZM5R8S8PDFI463Daqzvw5TemCC uHEOJYY/LWHt85S8C93NL3Xcvmp2UWoPCBVQCfF4EuM/PZ560COL8Ce5RT1xdV5wE+13 w/zdP4NCz8wMK3JLFbziWSUqLrAVaCl2ujXqU8xvjGtc4WAiZQPCdKAnySMmCPgi0HMM r+I7ivIdaBxN7LejGstCAEVxRNMV7qXPR1ZFmj1g2/LxILpRneGjBnOwF+UDz7vesg0c C3Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=UsGar6ggRLZuBaiFto+bDBQ9gwJRGx7wY1pvF3IPzf8=; b=jf8eZQBL6g2liiR6Es8ovLlGHwb6P/3gNvHcqQTCoIBWGiB9nE1u3SElI5480AcNP7 qSX5p2PKpZOLfm4erei5s9s5Fl7T8Tn+6Sm8ddYBf7xd6k1GT7KQ+l5qpcOhEDjvjf8C 4OEoh7+TWrzRVUOIGCWj4kBDnNYmOngUK2SbX5fyDp3TFaNqDeCKuw7JtlxKSqq4FMVR ywYd9Tn7IzXpBuvM9Ih/QNlP1bl51dfMKgusW6mE7jlBtV8KgVsDNye+ICYXW5j532wq dwy/INwI+W3r4p454oX7Hlmk/yACtShW7xoAzfRSbTyPGfoVdFLWMH73r13QncY5rbCQ 3uPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Hmq1dj0F; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si4487753pgs.830.2018.04.08.21.04.18; Sun, 08 Apr 2018 21:04:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Hmq1dj0F; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754685AbeDID7K (ORCPT + 99 others); Sun, 8 Apr 2018 23:59:10 -0400 Received: from mail-co1nam03on0131.outbound.protection.outlook.com ([104.47.40.131]:30557 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753645AbeDIASg (ORCPT ); Sun, 8 Apr 2018 20:18:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=UsGar6ggRLZuBaiFto+bDBQ9gwJRGx7wY1pvF3IPzf8=; b=Hmq1dj0FalJCZIEi51CVDhhCO/zhl87/lb239IbaNxg4zxvwzb4dXcTsioDXQGIeMJJcNLaB5BRJacm67iGTuVTK+BO5hyoSJCVNpk107Wo7ZFWPllP+wW/OaKUcST1FJMzO0f8j7CBz4b6Cwx9fpGY7MOEerek8+W5CfIEtk3s= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1046.namprd21.prod.outlook.com (52.132.128.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:18:32 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:18:32 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 069/189] f2fs: fix to update last_disk_size correctly Thread-Topic: [PATCH AUTOSEL for 4.15 069/189] f2fs: fix to update last_disk_size correctly Thread-Index: AQHTz5grNxn16xWUIkCJh9BYzrhgdQ== Date: Mon, 9 Apr 2018 00:17:39 +0000 Message-ID: <20180409001637.162453-69-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1046;7:I1SkAK8T9qYOQz0T0V8JL5jegJub3rUVee4v6dCUdtPt2kip1Hz+ZmduJ5RS6XntWxJywq5sygL1dXGuuE+mDhzAnYdaUmotkQg8m42V1Sg/WXF8/gM0yVThudtPSlG106/+/k4zG+N0ORd16rm0FUFMfp4BIqdzbdB9HmFg4CaxAgXJms5Yd37SP6SYj/v2olgcsLS0BIkXD3g2fFtevrf9YQLxBI21mXxrFs2PSx+4Xc0B57btSHI60SPdj5uB;20:BxP1ur1D3XsgSMJ5USEjX1jA2JXNWDvQ5+7kp12AUlwfRP0tp7sGG5QZxtnf6d5YWc63MS8WRUI4zfWUtejopxRiaR7vZRisBjWPg+k3t976Pml+n/Wf0GwW2xgwM40T6kPgADjg7qJh5czSTArmUQ949NJ0yczsFiLJet2i3Qc= X-MS-Office365-Filtering-Correlation-Id: 33f41473-c1be-4d6c-b05c-08d59daf6d59 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1046; x-ms-traffictypediagnostic: DM5PR2101MB1046: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1046;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1046; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(376002)(396003)(366004)(39860400002)(199004)(189003)(36756003)(575784001)(186003)(11346002)(446003)(476003)(2616005)(7736002)(5660300001)(26005)(10290500003)(478600001)(106356001)(68736007)(10090500001)(54906003)(3846002)(59450400001)(22452003)(6116002)(86612001)(110136005)(99286004)(86362001)(72206003)(15650500001)(305945005)(76176011)(102836004)(6506007)(486006)(316002)(3280700002)(3660700001)(81166006)(81156014)(8676002)(2906002)(14454004)(2900100001)(97736004)(6486002)(8936002)(1076002)(6512007)(6436002)(105586002)(25786009)(4326008)(2501003)(5250100002)(53936002)(66066001)(107886003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1046;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 8G8dTSBU/65rwiIOY8aBBl9fkIbLhF8nw91iXp4cCsg7oLnA/k/9HATO4xZtinBmAjSC238BKi6e0WzapL5XCOpE97R4S/kcNFVKGngVVcVUv0hk9vDbwthPUQ2nN+PIJjW70IL7FrNiAN54p6An984/FYNcpDKLpiIxcVdVan2Jr/aZKnTarp+XdwwowLn/I1dd8TTJWibhMQfpCAC9eNbvd5RpTKRYh05yhAH4308Q2nO+iR/vPZnJtEDN9F+hypOTp4wfR/+yoG28W1CPA6zsM7JPS4KxxB1ojaa9wOsojN6byO9ZO5WDaSlsU7DFPoObharBMz7RqvGTBtMRCD5E/SbIN3Zddj0rymMnZUJZssfPeJdLCsCMSHc3psbF3KAI9lcMF+BUgg5oO9wCj6nRiAuBBpvwVwEjCwoCQpg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33f41473-c1be-4d6c-b05c-08d59daf6d59 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:39.4305 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1046 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu [ Upstream commit eb4497975e82448746bb7de3d13b743b7145aed7 ] This patch fixes to update last_disk_size only when writing out page successfully. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/data.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 516fa0d3ff9c..3399ddb723dd 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1571,10 +1571,14 @@ write: } } =20 - down_write(&F2FS_I(inode)->i_sem); - if (F2FS_I(inode)->last_disk_size < psize) - F2FS_I(inode)->last_disk_size =3D psize; - up_write(&F2FS_I(inode)->i_sem); + if (err) { + file_set_keep_isize(inode); + } else { + down_write(&F2FS_I(inode)->i_sem); + if (F2FS_I(inode)->last_disk_size < psize) + F2FS_I(inode)->last_disk_size =3D psize; + up_write(&F2FS_I(inode)->i_sem); + } =20 done: if (err && err !=3D -ENOENT) --=20 2.15.1