Received: by 10.223.176.46 with SMTP id f43csp278326wra; Tue, 23 Jan 2018 20:55:12 -0800 (PST) X-Google-Smtp-Source: AH8x227Q9OU+40ym8z03xSchKYhwY3lvjScoInFHly7+Rqm8p4NjfiFwed4Ej7ON1ArF3/po+P+k X-Received: by 10.99.127.85 with SMTP id p21mr9994291pgn.137.1516769712206; Tue, 23 Jan 2018 20:55:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769712; cv=none; d=google.com; s=arc-20160816; b=rey3AHoMUki7gw+4I2+WqJWk2WDC1EZM+F5CovHIPF5yul4D2gSOrTNA1UZctlnvZ2 aw/WwjtRfmA1lozQ51WnfkhkzUUON0p/TGiRf0YYgOPmLcPOW8p4Az+IKIfv6da0gWvg NBS/LujI3EUw/cC8o3EsIRKMyXOSJVJqhCr4G/hnntiJoaQfhkRwzJwXqb+0Pij3u/ui SER1QZ8jVvUq0OvK0eDLP2jabF8fiDpnQ4xprRxkciw8T84l5Bj1lT892B8Tf/rA+Kjb LRdD5Nyn06vcsODvEYCtsg0hHcVJWnLzWd505ugKQd4lpPKuTybWp4AmqI9T7wiVa9HV hBMA== 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=HNF3J4XXcnYnf9dtsmtMOGF7iPjhAZjS8BUvIuMYPtQ=; b=UWXtRFIkLoO9U5R5+hUVZD5apCVjkQBAB1hfDR58NM7+cZjv5eS5J0XWzVFmGmdqKv /1CJabMxdIedpdg75XL37FHR2NYx9Zp9dduerY+o0A1UHYf8f0NUpH4L9BoXqDcZ867z +RazAA3F+3X2U/5TDm+4CGSmiLhdAihPF/nGVtTKYhS5O+VTwgT2lE+sUoMDBFHWSKoJ DvDFE6MlmlOBcLiy27PwyRq+9Wt0qDfbVbetrNt1MU9N9xQcJl7OaJf+JzdQmMrQYpcS P+53Nf4AoU2g0fWqlQ4Oxh5XR/r+73UMP/j3dqnmgmMPBEGx8WKY2mydQOY1CZKZ+JM0 6u8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=hw6ELa2b; 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 w10-v6si5548773plz.107.2018.01.23.20.54.58; Tue, 23 Jan 2018 20:55:12 -0800 (PST) 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=hw6ELa2b; 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 S932779AbeAXExP (ORCPT + 99 others); Tue, 23 Jan 2018 23:53:15 -0500 Received: from mail-sn1nam01on0105.outbound.protection.outlook.com ([104.47.32.105]:55328 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932432AbeAXEP6 (ORCPT ); Tue, 23 Jan 2018 23:15:58 -0500 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=HNF3J4XXcnYnf9dtsmtMOGF7iPjhAZjS8BUvIuMYPtQ=; b=hw6ELa2bJuJ6SCeML6dK23svvl8gowwuBys/CyiYpViAtP3IcjjdlWsOJxYTthzfI00boCyeB3wSFmudTstvAlHzw4eg3DyylEMI8nfG9hRj0UJh/0K4h+HAgd3BBvEAxlN6l1Yxom5EBxs6UbNvaZzOffEXG8dwdiCvk40InJQ= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.0; Wed, 24 Jan 2018 04:15:54 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:15:54 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Chao Yu , Jan Kara , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 064/100] quota: propagate error from __dquot_initialize Thread-Topic: [PATCH AUTOSEL for 4.14 064/100] quota: propagate error from __dquot_initialize Thread-Index: AQHTlMnkFl762ML+VEO045cTX/jwAA== Date: Wed, 24 Jan 2018 04:14:57 +0000 Message-ID: <20180124041414.32065-64-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-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;DM5PR2101MB1015;7:FDL+wHB7C4VJOL9TGgcbxlCdIgikAmOn2YSNUKlIWTgzA+r6BQn23/LWokeDaq3k/0W16LEc8kzcyLiq6932h7jGefUPNf6aOvj0BVyO8x655b/PnWOdSuwZrBbGP63f1w4CZB5Pqgoaz0R7ulspfC6s+GKV/Blqu+L/AJmnx9vTfmNdWC5lDehfuelsmL0/nnA8zT8rkW/V7T0r4EP3ht7Qe4fBCzCP88HpBsGIsAzHqC0i+fCEYGp60mVvCaeH x-ms-office365-filtering-correlation-id: 48722ad2-0171-429c-a5ae-08d562e1294c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231046)(2400081)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39380400002)(376002)(366004)(39860400002)(346002)(199004)(189003)(478600001)(106356001)(6512007)(53936002)(2900100001)(15650500001)(36756003)(102836004)(2950100002)(2501003)(10290500003)(97736004)(14454004)(81166006)(72206003)(8936002)(6486002)(1076002)(10090500001)(6346003)(26005)(54906003)(4326008)(575784001)(76176011)(99286004)(86362001)(3660700001)(105586002)(6116002)(8676002)(68736007)(22452003)(66066001)(25786009)(6506007)(5660300001)(305945005)(59450400001)(7736002)(3280700002)(5250100002)(2906002)(107886003)(86612001)(6436002)(316002)(81156014)(3846002)(110136005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: QLAY+rtGBs0l3Y5J6HhxyMIcGkwljZRbPRgXR1gF0mzEK7WI9boeNuBF373R7VrpZ7qeHog0RjBvPdWcOECHVg== 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: 48722ad2-0171-429c-a5ae-08d562e1294c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:14:57.5163 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Yu [ Upstream commit 1a6152d36dee08da2be2a3030dceb45ef680460a ] In commit 6184fc0b8dd7 ("quota: Propagate error from ->acquire_dquot()"), we have propagated error from __dquot_initialize to caller, but we forgot to handle such error in add_dquot_ref(), so, currently, during quota accounting information initialization flow, if we failed for some of inodes, we just ignore such error, and do account for others, which is not a good implementation. In this patch, we choose to let user be aware of such error, so after turning on quota successfully, we can make sure all inodes disk usage can be accounted, which will be more reasonable. Suggested-by: Jan Kara Signed-off-by: Chao Yu Signed-off-by: Jan Kara Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 9f78b5015f2e..8406be97a518 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -934,12 +934,13 @@ static int dqinit_needed(struct inode *inode, int typ= e) } =20 /* This routine is guarded by s_umount semaphore */ -static void add_dquot_ref(struct super_block *sb, int type) +static int add_dquot_ref(struct super_block *sb, int type) { struct inode *inode, *old_inode =3D NULL; #ifdef CONFIG_QUOTA_DEBUG int reserved =3D 0; #endif + int err =3D 0; =20 spin_lock(&sb->s_inode_list_lock); list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { @@ -959,7 +960,11 @@ static void add_dquot_ref(struct super_block *sb, int = type) reserved =3D 1; #endif iput(old_inode); - __dquot_initialize(inode, type); + err =3D __dquot_initialize(inode, type); + if (err) { + iput(inode); + goto out; + } =20 /* * We hold a reference to 'inode' so it couldn't have been @@ -974,7 +979,7 @@ static void add_dquot_ref(struct super_block *sb, int t= ype) } spin_unlock(&sb->s_inode_list_lock); iput(old_inode); - +out: #ifdef CONFIG_QUOTA_DEBUG if (reserved) { quota_error(sb, "Writes happened before quota was turned on " @@ -982,6 +987,7 @@ static void add_dquot_ref(struct super_block *sb, int t= ype) "Please run quotacheck(8)"); } #endif + return err; } =20 /* @@ -2372,10 +2378,11 @@ static int vfs_load_quota_inode(struct inode *inode= , int type, int format_id, dqopt->flags |=3D dquot_state_flag(flags, type); spin_unlock(&dq_state_lock); =20 - add_dquot_ref(sb, type); - - return 0; + error =3D add_dquot_ref(sb, type); + if (error) + dquot_disable(sb, type, flags); =20 + return error; out_file_init: dqopt->files[type] =3D NULL; iput(inode); --=20 2.11.0