From patchwork Thu Sep 15 18:57:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9334591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE68D601C2 for ; Thu, 15 Sep 2016 18:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC49229A5F for ; Thu, 15 Sep 2016 18:58:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A10FA29B0F; Thu, 15 Sep 2016 18:58:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 104D429A5F for ; Thu, 15 Sep 2016 18:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753656AbcIOS6E (ORCPT ); Thu, 15 Sep 2016 14:58:04 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:36874 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753259AbcIOS6C (ORCPT ); Thu, 15 Sep 2016 14:58:02 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8FItDv9013316 for ; Thu, 15 Sep 2016 11:58:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=XHlcpMFwZp9QY33GimbNa5C9bN2K5oURrqP/S70fd/0=; b=Agy2C9FzlydPxw4iBoDqa34277bZr1Tr9dPXPGrvbqavyk7fEdJUJNQ9RYco2+A3q3lC 49pAyjyuNfDHN6ftqA5V2NEQOF3NgHz4aGgpUF0NH+G7p4PIxHpvB04lrMtUQtvr1+ta BKLNu1Mb8L7kGromO5eS+w2d3IC1ixvEtAs= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 25g12t05sc-20 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 15 Sep 2016 11:58:01 -0700 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 15 Sep 2016 11:57:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zuuJ7d8oLZ+AZyb9yu5703Ahai/Y9TWqSvGn02rm6hc=; b=Lsqoy4L78TlMGKGpKbShdh2lF+mPXyjHo2fFPyss3GEaXyF4RAqUit6IrzN4ezXSWBwVohXZIlCCQpfzgQx47XYdwGuC//4Hpqn4DV6fI2JZuCZWWyCttf03NhjlgF3NveJAMkM2BMLYnCzFSyelzLHDNLXzXpk5FvSW9JBX8b0= Received: from localhost (107.15.72.49) by BN6PR15MB1313.namprd15.prod.outlook.com (10.172.206.139) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.10; Thu, 15 Sep 2016 18:57:51 +0000 From: Josef Bacik To: , Subject: [PATCH] Btrfs: handle quota reserve failure properly Date: Thu, 15 Sep 2016 14:57:48 -0400 Message-ID: <1473965868-9675-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [107.15.72.49] X-ClientProxiedBy: BN6PR07CA0030.namprd07.prod.outlook.com (10.172.104.16) To BN6PR15MB1313.namprd15.prod.outlook.com (10.172.206.139) X-MS-Office365-Filtering-Correlation-Id: 51ff496b-51a6-4d87-e308-08d3dd9a3194 X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1313; 2:1hFgYJx/F9XT2OVPpNDcr0nNnUJQjLmZBWqbRO8yn6e+yhX4zu7cPTNPlMaJ3FMKHjTv4NE7jfYMZabcQj+S/IV/jJk1jzyhG4i6Bpb5jgJJz8zSGajpnmDucJdSn6A+ZCjp57R73em8GETwUFFlpzsMTvl9Tmtd4qjM841v0vtC07Hvqp6WCgaUbiy2YJYr; 3:tLwKTN3MMWLkbyqDFSaXp7VJ653vt2l7Nrt6bacg7gdW80KT7UBkt5FEAFFc/Yr+WMHZeU4F37E4XItFZFXUDTY93Hxm2ndCqFnW31B4yC+M/raVRzouYjRtSs1F7pCl; 25:/qRWqXpFG8h20g26K8fJvr7pYmZTIU1byAGjMUxpDHqQLHhHG8w/pbmdAwAb1w8ta9joEtYiqiiYnbynJ0NwoQBKVWnb8QzhBrJYGDj1icgamwLlFDt+tlTKkEBFW9UnH4GHejt5FetSNME3h8EhU9MMG2I2+CvRL1ev5xBYSXy4uTmcGFI2exR9ISRCdp83dEZSH+3u1mKMp9f/SoYefklhLRDtUV7NUal1VFpTWXM//dc6NBwj1Op/1jTbO7FODaI+5q81dBwfa48+1GaVCtXRG0IL0Ji9VQhBYHJXcAtYAgue2kUsGK94TiTGoqxNpl56rsK5khajqQ3zdKJkE3SRqsUcCkiQTvLRybM6/Oaiws6wysXIznIW5G5h/zE6AcGvX8mHcz/XyKx8FU6peqKqFl6pXzwYWNse+B5jPfI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1313; X-LD-Processed: 8ae927fe-1255-47a7-a2af-5f3a069daaa2,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1313; 31:wbb24dnNUsXYWJplpXwc67bRdpXGczeOyvrFxLXlCmfwPbzqSfHmlyBlpO3iU8WqpLfWPrfU213piDL0VkrBNANfVwBArm9ut3xf0LeU4qV01qEtMMxOp9z6vT7FYW4Detwi476H6iRQtrkmYN2YJ9WTY/oeHiQPw0MaGEe+e0jBNO/uz+hCGDPl+3N35IlmmPuv3Cw2aJe9Mrm2SWQ3dM+vA7uMzgBrLjSVbGEqWSc=; 20:NndhO2nZMeGHG2e7s6UQgpRSrznizCg2C/OM0Gi5LIQppbbKswLek7BzeeIkWtf/PTRw1oKKFb99FhcEv7b5NWDXu3kgdgpmut/KrnJCZiVe89+DMpbkKJo/KP/UZtRbEdkXWBaBlPynI3u7Lj0yvTbNHAiRzRvsEWex0SO5OHM=; 4:Fp4ksVxOAE5BEYbuDOXPRvaSzj47I51L1hXhBNl2Ee2ogPCgnjkPXDBjj30v5M0jRTOfnf3rREs9JGzKWPEiPp1KSrfcXHJNyk/+3diWs4YwkKnNj2H0G9GT8rjiVNoZOEdQiXOBoS+1xdjJOMUfIfvEQxUt8NvWaHRUgAOFV3LA8b1Fy/f+75aZ0jEpWSI1GoG1CA9YAVPRfoNdtaYwRaUVVgJ0X3GINRJujHmIAd509dD4NEjpePPNbful4YYCfDwXX9JvsySSVPA1RmKGRfrx644gH2FtwY5N64ntttbnO8nlUGDhUkl4cyflHezz0XKRGmz+pyOGUVxY9ZZ5wlPv962hHTbs5OQPFCIIDAiyo2jwMTjbEBkGqvZdbRdK/7FxWEUlzsIW/0ExN/rb8JZMwsGJSEdfniegNeIusZ4IhLQOCLu/0pDIbxDGpSRg X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BN6PR15MB1313; BCL:0; PCL:0; RULEID:; SRVR:BN6PR15MB1313; X-Forefront-PRVS: 0066D63CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(450100001)(81156014)(81166006)(8676002)(5003940100001)(305945005)(7736002)(5660300001)(77096005)(5001770100001)(6116002)(189998001)(3846002)(586003)(33646002)(66066001)(97736004)(50226002)(229853001)(76506005)(50986999)(42186005)(101416001)(86362001)(92566002)(47776003)(106356001)(105586002)(19580405001)(48376002)(19580395003)(107886002)(7846002)(2906002)(68736007)(15650500001)(36756003)(50466002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR15MB1313; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR15MB1313; 23:RpjOTJ7oYKAOo5WNCGuobWtnwn9r74QlL81xGqQxx?= =?us-ascii?Q?T69Ug/Kd0eMbyKpyrAdlj6myg134spog71VBc8tJBFkIp0UFKCLe+hO9CLS+?= =?us-ascii?Q?je7U1ck4oiI0OO399L5EjYahDri7T6Il/VrI3TBNw5EyHxvq5nA8ymapRBVV?= =?us-ascii?Q?rEHsMjFCOzNj11YRhRxijK5RfZPTShSUPAT/5gyb0SnblLQG6ysS1yTBlXgy?= =?us-ascii?Q?g6FFJAUOkVQn7TXDaCP+XJBvzw4mgj/2MYa87qAvU2opT5+yXLZ7bxMYuBl7?= =?us-ascii?Q?YQIo3wxoJZ+KutGHHg2CQfR10/D8w/KvtQQdP9x4qYkt9TEDMtrzvyU9pr5V?= =?us-ascii?Q?1xHF5duJIgqr0cNclyeUY7xiIlYpQcOFMdnivB6WJl3U1CbwkRWIlRhYRzob?= =?us-ascii?Q?b9vVwuMhlbF7m79WlbOibnX3bCDIG6YPLLyaclrUoYclyriA3dvB+5P9BYKo?= =?us-ascii?Q?RItRaYFDHSrw5iv9Yzm0hGX7Q5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YvQ0p9tabuSc6sq7ifJbGGMBrw0H0QqKR/5r0Rf7ggcuQ9jGULdUApqIJJj+VVn/nUTqEgeQ2kOGdb3EzmlIYM=; 5:abnPetd9Gni8zPHQ+jXNtWptHECiXNL2QhcZh/VXRKKP9kx7r9mBWzR6LkHGYGbsLJJHQC3dy4/gkGrFsYdqEh+o0Rz/3AOBDoqG1y/bHwSrXxsmCDVviDDa5hxqDINhZY3Vb3IGICUoaJYlFAARpw==; 24:kuRKzKwjJM8GpOgG/HdOiOrnNl0K3afoFNF1MehGeusG/RoZQJyI2S6BtxHJPY1qsymdBSfa/zeST/mR3LNcF/lvv7pHH6rj3bhDWJjpbPg=; 7:NDQv3Oh7z4KWkEa0ACxWSmY/RtEzKNTMfmFzrMOUn8ZAbspFRF3ldVTaj4gjO2jf0ZrsanPCoFZtwZQyXqo+01bWkaxumJx7h/UZQa14YKYp5Gjip3VnZGatEsUVjxHDNVvPLHdnmzJFe30yaQMPErSRGdxD+0PmxqXmhQB+P2Hi7LrBA3PhJUGAi+TSTcIWNMeprx71rGYtwheyPk0DuOhSDU9tUn/u0brVODo5W+CqgH35dmDNFG+h/7D5LTzK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR15MB1313; 20:E1Q/qcU3Y5MtGmvu93T7UBy2kqM4LOYV6+kDFMbQXu4EOKzs+e2QN9HdqkuPcFGy770PfhcHyO/Lzc0UOCz0B3yo+HWvTpunhTtqYneWyxZZudHU+gZfADScrggaLINRsJnQrTtreEHHYcrS3gQv26Q7drNY9yRz/LlaPlGZDoY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2016 18:57:51.4894 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1313 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-15_09:, , signatures=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP btrfs/022 was spitting a warning for the case that we exceed the quota. If we fail to make our quota reservation we need to clean up our data space reservation. Thanks, Signed-off-by: Josef Bacik Tested-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 03da2f6..d72eaae 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -4286,13 +4286,10 @@ int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len) if (ret < 0) return ret; - /* - * Use new btrfs_qgroup_reserve_data to reserve precious data space - * - * TODO: Find a good method to avoid reserve data space for NOCOW - * range, but don't impact performance on quota disable case. - */ + /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ ret = btrfs_qgroup_reserve_data(inode, start, len); + if (ret) + btrfs_free_reserved_data_space_noquota(inode, start, len); return ret; }