Message ID | 1464368468-3256-1-git-send-email-jbacik@fb.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show
Return-Path: <linux-btrfs-owner@kernel.org> 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 5E3F96075C for <patchwork-linux-btrfs@patchwork.kernel.org>; Fri, 27 May 2016 17:01:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 465E027B33 for <patchwork-linux-btrfs@patchwork.kernel.org>; Fri, 27 May 2016 17:01:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39FAF28160; Fri, 27 May 2016 17:01:39 +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 A9A3B27B33 for <patchwork-linux-btrfs@patchwork.kernel.org>; Fri, 27 May 2016 17:01:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756241AbcE0RBe (ORCPT <rfc822;patchwork-linux-btrfs@patchwork.kernel.org>); Fri, 27 May 2016 13:01:34 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:23191 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756222AbcE0RBd (ORCPT <rfc822;linux-btrfs@vger.kernel.org>); Fri, 27 May 2016 13:01:33 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u4RGwlbk031057 for <linux-btrfs@vger.kernel.org>; Fri, 27 May 2016 10:01:32 -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=m/xfLVcvWCNBZ0ot/wmgehfJpxi9aVrt6929sBWp/Q8=; b=bhz1tBfV09oKh7nY8mIvl1PVKQzG7fLLshpElhYhy/IYj4aSW6Jc+kPPmlGXX1nhc8oC tc0sSIVbQqtCcz+cuFV602o6Eb8ZnNjPyVLuZvGGHtgTvIM6qoLMPklAmS1bEPkvR/E3 a0vmCltLz7PRapXj2FlmrrM9CnZ2N/H528U= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2369pg4yex-2 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NOT) for <linux-btrfs@vger.kernel.org>; Fri, 27 May 2016 10:01:32 -0700 Received: from na01-by2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.22) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 27 May 2016 10:01:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zjPu6A3SNw2ouCnwWWUeQP7GcUlNJcqM8koqLWs8ex4=; b=jU2BeUGV5mF0dsgPBehbgUxQLC27hlJs67VQqHEU4nNbG83V7gADclzysit8p66vS2pnC/DrSPn0aQIie0Ii7So0TUvLU7TH9Mwa/KYh8vP8OOEcucOsQ0dx5+ugZ+TyoHZjclRRUiKd87dW4pBLmuuzQ1np9l9/+osfPTNOgGc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=fb.com; Received: from localhost (107.15.72.49) by BY2PR15MB0837.namprd15.prod.outlook.com (10.164.171.25) with Microsoft SMTP Server (TLS) id 15.1.506.9; Fri, 27 May 2016 17:01:13 +0000 From: Josef Bacik <jbacik@fb.com> To: <linux-btrfs@vger.kernel.org>, <kernel-team@fb.com> Subject: [PATCH] Btrfs: always use trans->block_rsv for orphans Date: Fri, 27 May 2016 13:01:08 -0400 Message-ID: <1464368468-3256-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [107.15.72.49] X-ClientProxiedBy: BN1PR08CA0011.namprd08.prod.outlook.com (10.242.217.139) To BY2PR15MB0837.namprd15.prod.outlook.com (10.164.171.25) X-MS-Office365-Filtering-Correlation-Id: 568f19be-cb4d-4b65-54c8-08d38650826b X-Microsoft-Exchange-Diagnostics: 1; BY2PR15MB0837; 2:Hs2tOhEsRZDTumZmxVpYERfcI9ogni0RG+pqzMYsNXX6pt6TgwwpzCYNyoK3T5vwfQtUmgGIUhYTIY6qWBRxRkg4Xb+gGJx2ZpEU8Sho196C+Op9FexT5OVxGB7cd43G9CAhg5N5FKqsiPaGaj0OrFPIh/aE2ubJ0U7HfbnuEBhB5NKmOcTo4MYf5kbTINbj; 3:AWCrLWgOx3R+y2v6HURGlA33CdFTZ7x/iK8QEfqcIUX712XN/HnLXMCmtn756DgbuK2R03RgUEEVEc96pN0UL9LJksq79tUpm7phFEYHdZMwVDVjMHOEP+t8Jz97cS3Z X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR15MB0837; X-Microsoft-Exchange-Diagnostics: 1; BY2PR15MB0837; 25:vFykEQyBB3g19jD9Dqho8L1QrSclRRUR9h4OQoeljdMA19O4GF42H0slMxaCv8gPujS8JOblaW3bRIpcDeVEGFnNNcBMk2rUVU5mppUX/GWgoCmrD+RE2ARNqO/nQLKYgvfZEG4wYTKrM7izSsmUd22DRfN92jnKlkta/SxgEUSZ26z7r77J+LhIGq6VU8O8iIrYBsnAz0SzaU/q7HQpJEs5lSWhWd6ke4CXmLpvTFkWpBz7++04mUYMLGCOHEKwFNlIN5l+fpueMWRVBLs1BswEY0VnBHlES/9JNWY2N6371Q8uuzSwrPJX/ijHsYWPdfORWgx1fffrw9yxcTcelVFtKAOE9SKcTljdgjTQM2UrPRV1HaTpMw2HplV9A/bWrG7OiDbasALBJhjwyOhk7EmKya216SLZ2MOumU0AoUgXeAfz9Q7YMkHI8s7O6WIIEbhni+npMnxQqsIn7ni6EvarNGEb2zAYk3ln6zKsCuVXyPGNXsGPHqlwCESZysPIihknHoomTZgxe56BmLprHdmUNhsDFdTALVq0o8WwtI7K4ThantKNpv6JNQ0UhkHLIehp+niE74pVFZTuJeNhpWj7QypAgJ/JEzag+H8fKkLGFqdLmV+sWFx7gxAjwUHqhIsEDIEq4udtxclkJYZMhH1ZLySDldQsn091JTSs+uSx9+6ZK8/sQW5V6D6PklAEJsnB1pnlllQE2UFt3pIv7pUi1FwU6EebGDqAe7TUGp0=; 20:kiLSHgrwKBddKXnLJTh2yxR7Yt52OLn7s7FJ3VsirgcARJKmAgEaeBMX+jVEcg65UpTq+2BeOPtQ1UEWld47AlQ+menl7oUesMyh4h/QglARXCnmQSjKwgWeteD5Ny33ffxHrjNELbAOYcjwhFzOZrQCboPzF1MoblwJI4DYLLs= X-LD-Processed: 8ae927fe-1255-47a7-a2af-5f3a069daaa2,ExtAddr X-Microsoft-Antispam-PRVS: <BY2PR15MB083725BFD3EE4DD8BD74F0C9B9420@BY2PR15MB0837.namprd15.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY2PR15MB0837; BCL:0; PCL:0; RULEID:; SRVR:BY2PR15MB0837; X-Microsoft-Exchange-Diagnostics: 1; BY2PR15MB0837; 4:2AVLiHLnVteHV4uQKXZrE5ROFF5XLQN40xohH+RkMHlAfKTwLJf+M8n42AtvmJ3fOfi9f8yVtxvCwkBa2/o2ANMtw4z9lU1atVINtH6qdoxmnltQqSfCi4DMzNtc6+qg2PL/g69L2ZQEhdzvl+Ib1vsVdguE/wDyLSAiJtw4x1iQEFwza1q8a7NrgRSwXxS3Bfaw3d2w2oSMcqSG/1ZGGIFbXrnHF9BHN7LjZzmuZbL10COMHDlIPWbRfS9xBXPDwXKJph0MP/PhtJd+CYL+DtD4hM69D05zFMcpUDx+FbQj9lkVNsPyybtf4qr8UcCT9ZdsaYgwUkzhGoKR6eCw3wiHHSp/UxP6XVpPv8kj8AW1QIca+66rZLwXBqJ7KTLplF5Hd1LMHkd6FCFa8jPmpzpZ3XeCxAPnzqU+1sE0Ths= X-Forefront-PRVS: 09555FB1AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(42186005)(50226002)(50986999)(76506005)(33646002)(2906002)(551934003)(92566002)(229853001)(450100001)(50466002)(5001770100001)(6116002)(81166006)(8676002)(3846002)(5004730100002)(586003)(19580395003)(47776003)(5003940100001)(19580405001)(66066001)(48376002)(5008740100001)(77096005)(189998001)(107886002)(86362001)(36756003)(4720700001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR15MB0837; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2PR15MB0837; 23:w4h4vrC0rwOMobKVZJDppiuf2BHVQYnOmVwb67S8UNsvGBvCXuihiTtZKP2TmoBW1TRjJe9zxywP5kS447Vo1ItBp2nVf81weQF0UWSzs7mDmk2KQLPZwM3Ve97v7vjHzFL81UNDgFx8KBWz/AQLG0JzAYydIixa/ZLMoJyoLUQISt1QUx+lEx4hcbPJZCcNI1NqIvxN59dsbbTt2g2FynYgk/iQORNfcyiYlR0T6xys0uJq4C8qUxxVnvpUGRB9J42iF24LkmFtKNLYjSgu/cuccvtpO9vqj3N2DIraB+sGINGAepgv+SMZPEwHh2863uIrpwg2/khF1S4YJO8VQ4kWQb7eiB0zQ6cIfaKSD4NC+H22MWjgjgPOuBvKAhN1AQ2hbQ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GbpeGlpgH7VpK1DpnljTg00wKqsZ0mbOr1jfKQcde0Y/Evi9rN62bsKSd6ql7CkO2nQ9kDfZVf7scCzn+KEw41ve5LxSu/43vVLt180T4k90mIkURb73uRzUa9qCHQRxfjlAfVC8n2K6S4IEXZTEnxvqr6iAIU= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 May 2016 17:01:13.1074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR15MB0837 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-05-27_10:, , signatures=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: <linux-btrfs.vger.kernel.org> X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 43bc9f5..528b9a8 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5679,7 +5679,13 @@ int btrfs_orphan_reserve_metadata(struct btrfs_trans_handle *trans, struct inode *inode) { struct btrfs_root *root = BTRFS_I(inode)->root; - struct btrfs_block_rsv *src_rsv = get_block_rsv(trans, root); + /* + * We always use trans->block_rsv here as we will have reserved space + * for our orphan when starting the transaction, using get_block_rsv() + * here will sometimes make us choose the wrong block rsv as we could be + * doing a reloc inode for a non refcounted root. + */ + struct btrfs_block_rsv *src_rsv = trans->block_rsv; struct btrfs_block_rsv *dst_rsv = root->orphan_block_rsv; /*
This is the case all the time anyway except for relocation which could be doing a reloc root for a non ref counted root, in which case we'd end up with some random block rsv rather than the one we have our reservation in. If there isn't enough space in the block rsv we are trying to steal from we'll BUG() because we expect there to be space for the orphan to make its reservation. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> --- fs/btrfs/extent-tree.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)