From patchwork Fri Sep 2 19:25:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9311539 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 7FC0B607D2 for ; Fri, 2 Sep 2016 19:25:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1FD2984D for ; Fri, 2 Sep 2016 19:25:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BFDD29854; Fri, 2 Sep 2016 19:25:59 +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 BE87B2984D for ; Fri, 2 Sep 2016 19:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754376AbcIBTZz (ORCPT ); Fri, 2 Sep 2016 15:25:55 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:55816 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753307AbcIBTZy (ORCPT ); Fri, 2 Sep 2016 15:25:54 -0400 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u82JMG8Z007996 for ; Fri, 2 Sep 2016 12:25:53 -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=PZJy2wpyebOrdYgHENBHAMcB/XOE3axImM0Amfk8X3g=; b=Eb2wP1cH4sF2cKrZxkMthwIGITG4UCbVIi+T8kninXNWryTd0EqWNkqVkIplFbfu5ebo uMVjNgpzss4yeVANH7oEPDuCgcm5WQYFVBzK2H3WEc3M+p1tj7K+/Np0638FnGzJyX78 jC2565J5ccXCjbK+up5hSM5J1MGOjG6iV+k= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0b-00082601.pphosted.com with ESMTP id 256qdu92bt-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 02 Sep 2016 12:25:53 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.25) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 2 Sep 2016 15:25:51 -0400 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=N8ucrdROh2TjGqPKhicG6rDYGRr7ckHKsmGSjyuazzI=; b=NkPX0VisZiws9sxpP3BuFYJadI+lTq+easUZMQzDIxzGmFBQtHxMUetz4mQl6btVY+avbenvLfg2wXXGUT8TDcJU/SG/CkpcE1DvwW4bkuFWgzupFKHatJCNxuJJLSVcZnz2YfYI9p2KUazhBDYM9mRjSKEVN5ZubCWIIJu2mms= Received: from localhost (107.15.72.49) by MWHPR15MB1326.namprd15.prod.outlook.com (10.175.3.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Fri, 2 Sep 2016 19:25:48 +0000 From: Josef Bacik To: , Subject: [PATCH] Btrfs: don't leak reloc root nodes on error Date: Fri, 2 Sep 2016 15:25:43 -0400 Message-ID: <1472844343-19086-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: SN1PR11CA0009.namprd11.prod.outlook.com (10.164.10.19) To MWHPR15MB1326.namprd15.prod.outlook.com (10.175.3.140) X-MS-Office365-Filtering-Correlation-Id: 6f6cd887-72ed-45bc-7148-08d3d366f223 X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1326; 2:Jz0tQsM97wAkKEQqC4wavq5SxfrjeblY6d/nDHNiPfozN+PTdre+qFq46UvTyOgX3xU4rGHhHH4VPyqHXBDLc7qmjlUZYl1NbGsldNADOqM3rW7+JA0Iti5Ao3O4Uog03T6yct+FCumnvIsx4TLNOBG4q5GPaLxGldpJscFsw6f7S1ABrnNMtXCh7iyhe1Fo; 3:em56uMi1zc9TyzQ7tJ6lK+IHJfFNDKzO44ztCkGD+Xu6bwic5oW6JuV1ocF7hrYnhE4SSBaM8zzgkAEz0thj/Q+rptsmUeybjDe2eyC7Dld8GqXp5wNu8kZfHIN4h5z5; 25:58V0N8Y5kxizFZqM7kVlIEZ8Ij9lX1NS/4qJf7gw6H0SP0DlbrJ1C5iSv6Kzht6Xm36c4fuD1sy5vOsr0Cz/LtnELlGd9lp6QFTIxHF6l/mmwUyibs0mnBhK8jjBgfer5z9S2OLgD8gOfcERfsziJrDElt/oOEP8Amak/gy9Am5wwYFkHVEvcMvbTNNN83Qj6Hvr9PS0i6jgMA0o3dnu164D43ZO6+GKAnbmNfgpYEddGbct5LsRXw+6PSduVWq10HY+pdSe0SghHbt+YAw+PsalgXBVypoM8/Z76Gyh9913+mbEdnpo2iX76OFoWWsve+b9xRzpyY6RiZPAJ+uJybBCjuVLHlsmTH4I7qEbCn51aEIBnfMg5NUDRduIZmoOGxqcj4dVwsYG3UrjPWlbsBf/Cgb3UOgUq73cT/lw4a0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1326; X-LD-Processed: 8ae927fe-1255-47a7-a2af-5f3a069daaa2,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1326; 31:tA3leTzTr3+5kkeSlKpQQOz/Uj3Bb98JUbELQ1+nnsbAOEj6jsg2olmYPfV1HBId+DLYg+CSdZt9OrZvV7Jbo6vc5w8sC9qch2HnQ5FLANQUqeAFCzEZOYsvM1gD5hduX5D/I5we+lFyNZwsFJcL0kSlYPN4Wy8ETadaGgHDBeNP1K1QsTd4IJ5JhitukyRdLi2YXN6PFjVTnFTRVf4n4HVdx3UOKwW9UpLNpaB7gJk=; 20:By9AQWD7E3+5VeeC19vkMEyxma2sgtleoAoeyzyEXBcC5PECzfSch5ScXbdsEOdJtu4jxQuX+imjXxDbonuH6zmv7M9eumDv5UE5iNbwZGfyVYX53pJgU850LgenBtWHYd2tnIyHCDLbpdmuPBdfxgl1vJ/l6zOI+562jOgaouQ=; 4:FXhjGzRjxRn970JPUOqshQBbKgN+YNQyT+ZWi6xkkx/Z8q09eWoXI/Zv6UzEP+qTa1kgTfFDtCiUjPajlaHsrDHtBeTtds2iJHS/l1Zp/ne2uuBKqctnCCoT8zuSgJwzW6MLULN2M2lm7GobYKGAv8ipF0gV7BeLK/ZSpQhVLGeCy6KtNlJr/siuig4j+3+6041ynsb47sYxiAuQo2fr4GxCMxO3TM7//VgQBWLCKrsKtARuRFrtElToXVqDIEPPwy5N1KF2r8lrtaqtWm8szc7L0HVLW/kLAZTk0RaFk/LuN5UamJzHZVgapyFxQ5oE2kxe6Tnv3Ts1c8sZOHvPflUhH2TqVtUUJlQXmNJjU5acmsLWzxd923GXP0jsveXW3rS9VhC8LyJRZcPkFvy6Ftj3XyUEXBBPz/kx1Mw2O5RpJsQWfYEey7iNggoCSnjM 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)(5005006)(8121501046)(3002001)(10201501046); SRVR:MWHPR15MB1326; BCL:0; PCL:0; RULEID:; SRVR:MWHPR15MB1326; X-Forefront-PRVS: 00531FAC2C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(8676002)(81156014)(50226002)(76506005)(450100001)(42186005)(105586002)(305945005)(19580405001)(19580395003)(50466002)(47776003)(229853001)(7736002)(7846002)(48376002)(81166006)(68736007)(107886002)(101416001)(106356001)(189998001)(97736004)(5001770100001)(66066001)(5003940100001)(36756003)(50986999)(5660300001)(33646002)(86362001)(92566002)(77096005)(3846002)(586003)(6116002)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR15MB1326; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; MWHPR15MB1326; 23:cDk0clJqbO2ubbjBWkNjxhaVH2FZ+BLk53u3RUasD?= =?us-ascii?Q?BwiC3C6E28594O7pdhMZ6ruAXl0peoPCWmjAQ6qgUnBKxVgAgUAsHhiiFNnk?= =?us-ascii?Q?I/PNxToF8pfcCU6vgejHJC41XsvcTFRa2a6dmoLY8t3er59w5O+LCjKNvogY?= =?us-ascii?Q?VxHfh+391xNWaQnODhOXbNwbXbPiSEAZGIAoZYAyiy53w7FXCqJjgYMj0KsJ?= =?us-ascii?Q?nIIcz1DEP21LRPjauCrlD/P8cXhgHTEDk9iLwOWbcReOfoVJ8xwnan22I2Ga?= =?us-ascii?Q?qLmj6hD+RPk2PPeQbrjlpkNw3MxD1/iYu7hYqm+FK0MOqFfHACq1Yx1Y5tce?= =?us-ascii?Q?GLC04c4pF4FOLMUFZYNDohP0MV9Tn7+l3gPdCy7tD2Ns27OYWZ7+bwJQ82LI?= =?us-ascii?Q?NSReVfqOgUrAmQWsnnhBzOU5TOwdmIhz6fT1AtPOBNQDdXLT0AvYP7KnZSgS?= =?us-ascii?Q?pTeVRDSwicdU2ZOJfFNPx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aQPKluEIndsfushBoHLR7TpUt2Aljo5rGbAo24=; 5:9vZUhqjLiyVmVGElkNBZqTz03BbN4XLRcQDJ6WG7ZFWw0iqYPtJ8iWlh8G+XHMMULw+igPq2lm8uI9R9eFgL7s19KoYxmxt3bjE5g984WYKIMHZy3m1nALPDj22MddAzRwlH9bUFD83iiMxq8Wso7Q==; 24:ImLFF1pczgtsTv3tgQGOtJwWpXZKx6mq9go9jYogdwb5Re+0sZaAm7QYxnPXyTQWBRapvp4btZZ+GOA6OFFhc8VlUv/8AfIWLpP+P8O7AQE=; 7:MRB6vK6BGlI2+ESRmx60GQI4qJq579Y0y82gZDjFybBqvQxU95dvQgJQAF+s6mkJ4AsoBcYMUEhrc7YKTGb8kITOphjb+Y6msZK/noWyRzBe2bRyMP5WZRO4hP8od5fnqk0pLFy6/rxi5CNiI4spN+3iQZNPsO1FlxQF8VjPKsBTYSTa3N7s+yp17kmK4NcxuubJ5lQItp451RA/cfhlXi16wih99J3VHWRdIjndzeLGTlla68SBsZBz1JU0sWAg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1326; 20:Hog6ND7t28SQ3hZbQgIrMisUgahxmuTMv3+g8Es9oot8JLwMstEcoWmlQ3aHNL8AdJBp0wZdZDLQFwF3PHxURz5MsJno4QT8TUYsEfg3Fqs7hSpE6CN/f/k5aJnkUNrIccVxujgMP2bT+olmEPqD3s2N7KXNUao5sQukEDVWUyU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2016 19:25:48.9423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1326 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-02_06:, , 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 We don't track the reloc roots in any sort of normal way, so the only way the root/commit_root nodes get free'd is if the relocation finishes successfully and the reloc root is deleted. Fix this by free'ing them in free_reloc_roots. Thanks, Signed-off-by: Josef Bacik --- fs/btrfs/relocation.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 7fc6ea7..62dfc2c 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2349,6 +2349,10 @@ void free_reloc_roots(struct list_head *list) while (!list_empty(list)) { reloc_root = list_entry(list->next, struct btrfs_root, root_list); + free_extent_buffer(reloc_root->node); + free_extent_buffer(reloc_root->commit_root); + reloc_root->node = NULL; + reloc_root->commit_root = NULL; __del_reloc_root(reloc_root); } }