Received: by 10.213.65.68 with SMTP id h4csp2197085imn; Sun, 8 Apr 2018 22:15:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/CMpaVHQHLWCEoMedFzpypcel2N7Z1TlA2bsZX/2c0vKCap4zj+s0tCsJ03oN/GW/foQaH X-Received: by 10.98.59.4 with SMTP id i4mr28020280pfa.26.1523250929633; Sun, 08 Apr 2018 22:15:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523250929; cv=none; d=google.com; s=arc-20160816; b=eRJwZGjSYlUHbcD+n9yshEaCtDwmbWlb9nM+/tiq7lfoPOX8U7VhS9cI3DEnE67mhg SCGrQS8B1g7nVE5MUax1Tq8xTvj1xgdSFDihRYGaxnlMbQv8AXDIvvTxJXXvkevgzwER SHRrj0ArDuaKg5xdxmnIUA4WoSRQ7mrDUPxsHuJxnRvdoNJLQxAbzp8XAruxalNvPe2V wevxLsUwxieoAPs2vCrQxyYtDAphuZK35vVP9zRGoot9JXzY/cRz3uyrNd6H0wb3Pbl5 hBwULc0Zy/21LlLeicScIffJWemNt8wkfdARfmFDiD5f+oUocaB4kWxNzTG8+LuquvOS RIAw== 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=1PJwMi/g0EIrHzTWvepPfiRhGIHWBpEO58iPpGDiRyg=; b=V3PPADb3wWfJlGRo8QWZ3xECPc0unDkWOMDAqEBsixnkiybeIa28Od6OzK0umiNvtr Ap6EwlxmzeDcQ5v+ZmNl+EjuaDxX2ycp9fxhXQObFtUiKWoJ2rQspXlbHcHXPHpKE04O 0eubkodO0RsvCsz0gPiU6mm5lYaDbMDdqvOv1RyJeHM5eleV+IufFrneyDqE9elXTT5T uLECrLDpdAMTr+8ou46zR8S+diaUw/xIQf4CwxdsgDjlzN2Mss6uUQRKJUgx4PRD2/RA t0/oD4G3L6zMjR7xbZlpjoC/hKondURZGcipF4UAwHPLb0jq2xFEm3MQhpw9fNpnXdE5 hKNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=eC90+8FS; 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 204si10558151pgf.771.2018.04.08.22.14.52; Sun, 08 Apr 2018 22:15:29 -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=eC90+8FS; 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 S1754254AbeDIAUe (ORCPT + 99 others); Sun, 8 Apr 2018 20:20:34 -0400 Received: from mail-cys01nam02on0123.outbound.protection.outlook.com ([104.47.37.123]:10471 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754232AbeDIAUa (ORCPT ); Sun, 8 Apr 2018 20:20:30 -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=1PJwMi/g0EIrHzTWvepPfiRhGIHWBpEO58iPpGDiRyg=; b=eC90+8FSp7rJOwRm2u2+h4JiqFgddqZnTsPrHqygn6GxymV7/BoWLDh1cR+3jNQVlTQn/5iVkyMq3LgAibf/2CD6YpLSSopkbinYgtAl+j1zDHOls6l20GSO+Hzkif3vs2+jwKemAl7xQvrDnfeVcYhBeOcrQ8hUWDh0ZZBGb3Q= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1110.namprd21.prod.outlook.com (52.132.131.167) 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:20:17 +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:20:17 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Nikolay Borisov , David Sterba , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 139/189] btrfs: Ignore errors from btrfs_qgroup_trace_extent_post Thread-Topic: [PATCH AUTOSEL for 4.15 139/189] btrfs: Ignore errors from btrfs_qgroup_trace_extent_post Thread-Index: AQHTz5hPU6f8F8vUxUq8EpSvrChf9g== Date: Mon, 9 Apr 2018 00:18:39 +0000 Message-ID: <20180409001637.162453-139-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;DM5PR2101MB1110;7:rTjQ7A1OOvNSRLkhqBkAqkrSfzJ7bo5zJ94wwaI0kfh9haAvCyKXKHBMRlcDhulqmQuvCK/ImXdehMibDOaf1FBvemJnfuXEB7PYE8G0MC/vfbGmhmZzidEqgOhgy/Of3AQ3Mv3t64SenRQTEZ0wZcYBlbu2ebbHpsZcnLJQ6YLt4TX85Ph9NT68KQGoBv6NpyvWDH9aVs5lgJ0fUX3vP87r9x50JNChYSvHDe9woMbR+EdDezRSmDOroCcqioZ9;20:sqAZ3qBu5rfptj8DdDyEOOvfuPWXWjKi/0KLbLKq1i0eUiUSexzjFgbI/AepujhttiDB7kSBiAr4SCzRfPlAxwdIIKeeMD2/0rh8bEl09kfGPt5sRm6rWb7McaPYOzZVYoG4n5gEM5V3DlIsVC1dYJg7I7eS9OS44UAzqId1D54= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: a1e577e4-25d1-4cfa-ab08-08d59dafac09 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1110; x-ms-traffictypediagnostic: DM5PR2101MB1110: 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); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1110;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1110; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(366004)(346002)(396003)(39380400002)(39860400002)(199004)(189003)(5660300001)(478600001)(86612001)(3846002)(6116002)(106356001)(6486002)(72206003)(25786009)(10290500003)(8936002)(6436002)(76176011)(2616005)(6506007)(2900100001)(97736004)(486006)(26005)(36756003)(10090500001)(81166006)(8676002)(81156014)(59450400001)(102836004)(2906002)(99286004)(11346002)(476003)(3660700001)(66066001)(6512007)(575784001)(86362001)(53936002)(105586002)(186003)(5250100002)(14454004)(22452003)(6666003)(2501003)(446003)(7736002)(316002)(1076002)(110136005)(3280700002)(54906003)(68736007)(107886003)(4326008)(305945005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1110;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: bITA4nHNvB8Qq/R1vdUsoisyLHGzOdye4FkhsVmcDKultrb7em/fK09NpOR1zd17JG+NYgoCM3vaOMDIotmQlYMQJ10Zk3sg8As8sak6BvnERRMvvtEcy8G7YK1F/kyjSfmAYzwGV2ae2fWSGVaTiCklM7ohp/Y0CX/I4QVsRrwt6S1/5zDPHGoWM6+eoyxG3lyVJdN0NQFtM79iJK1Z2QBiEDAyhkW1veQNofIlrkbGvoFEFHw9mX9wQ9XzHkrM9XYIhyiC5X3z/DPvC1LH0FMHUBf8Qce6RTiQrI3NSFpZQ94P5B9SuQ8PaXGhKY0LxNFgOkNZK9SVyQPOB4Vji6AD3ite4CtUilSihcOBGD7gN9lnBod0/5mf/zEAToUpIzzwOCMFzM35AgPmoRnkL4P16uoAtB3mBggGm8hXo68= 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: a1e577e4-25d1-4cfa-ab08-08d59dafac09 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:18:39.2846 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nikolay Borisov [ Upstream commit 952bd3db0dada9994fa7edd891178075abcc045d ] Running generic/019 with qgroups on the scratch device enabled is almost guaranteed to trigger the BUG_ON in btrfs_free_tree_block. It's supposed to trigger only on -ENOMEM, in reality, however, it's possible to get -EIO from btrfs_qgroup_trace_extent_post. This function just finds the roots of the extent being tracked and sets the qrecord->old_roots list. If this operation fails nothing critical happens except the quota accounting can be considered wrong. In such case just set the INCONSISTENT flag for the quota and print a warning, rather than killing off the system. Additionally, it's possible to trigger a BUG_ON in btrfs_truncate_inode_items as well. Signed-off-by: Nikolay Borisov Reviewed-by: Qu Wenruo [ error message adjustments ] Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/delayed-ref.c | 3 ++- fs/btrfs/qgroup.c | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 83be8f9fd906..fa552a5ac103 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c @@ -821,7 +821,8 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs= _info, spin_unlock(&delayed_refs->lock); =20 if (qrecord_inserted) - return btrfs_qgroup_trace_extent_post(fs_info, record); + btrfs_qgroup_trace_extent_post(fs_info, record); + return 0; =20 free_head_ref: diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 168fd03ca3ac..388731481e9d 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1442,8 +1442,13 @@ int btrfs_qgroup_trace_extent_post(struct btrfs_fs_i= nfo *fs_info, int ret; =20 ret =3D btrfs_find_all_roots(NULL, fs_info, bytenr, 0, &old_root, false); - if (ret < 0) - return ret; + if (ret < 0) { + fs_info->qgroup_flags |=3D BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT; + btrfs_warn(fs_info, +"error accounting new delayed refs extent (err code: %d), quota inconsiste= nt", + ret); + return 0; + } =20 /* * Here we don't need to get the lock of --=20 2.15.1