From patchwork Mon May 9 13:14:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Talbert X-Patchwork-Id: 9046621 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 74D5E9F1C3 for ; Mon, 9 May 2016 13:15:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB354200FF for ; Mon, 9 May 2016 13:15:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE382200F3 for ; Mon, 9 May 2016 13:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751702AbcEINPV (ORCPT ); Mon, 9 May 2016 09:15:21 -0400 Received: from sjc00mx1.hgst.com ([199.255.44.36]:52723 "EHLO sjc00mx1.hgst.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751393AbcEINPU (ORCPT ); Mon, 9 May 2016 09:15:20 -0400 X-IronPort-AV: E=Sophos;i="5.24,600,1455004800"; d="scan'";a="195222751" Received: from mail-bl2lp0206.outbound.protection.outlook.com (HELO na01-bl2-obe.outbound.protection.outlook.com) ([207.46.163.206]) by sjc00mx1.hgst.com with ESMTP/TLS/AES256-SHA; 09 May 2016 06:14:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-hgst-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MJb3SOZfAWFgYnddhgLhl8uCzbYdGdWQjrE/ErNqniU=; b=omr8l8WriNiFZN2Ww+20/ZSISPyy8QWZTV7984ap87Z7n1p0el7pL9JVicyroLnuXzDrHNNg9uHv0kBDxextGEBBbOFbJg35VVNe646ZzoM1U4TjV2iqPKsx0sccY0lZbAq4QcMyHb4L9sxkGM8NbzMQ65NCyKUYCUX9rsdwrN8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=hgst.com; Received: from dispatch.fios-router.home (108.28.75.251) by BN3PR04MB2211.namprd04.prod.outlook.com (10.166.75.145) with Microsoft SMTP Server (TLS) id 15.1.466.19; Mon, 9 May 2016 13:14:46 +0000 From: Scott Talbert To: Subject: [PATCH] btrfs: fix memory leak during RAID 5/6 device replacement Date: Mon, 9 May 2016 09:14:28 -0400 Message-ID: <1462799668-26910-1-git-send-email-scott.talbert@hgst.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [108.28.75.251] X-ClientProxiedBy: DM2PR0801CA0023.namprd08.prod.outlook.com (10.162.18.33) To BN3PR04MB2211.namprd04.prod.outlook.com (10.166.75.145) X-MS-Office365-Filtering-Correlation-Id: dc08c9c1-b280-4493-f201-08d3780be4f0 X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2211; 2:VykbybFJmWjQ13+dELEz01EYiRF3OhvXBXhK6tR0hUDrwjofdvsFBbb1oaXQderaaKKde2xekKJeg19NIIdF/K3HXNJYGKWTHPE+nFBPcJHM2cVM8soioH2CaYrdFrynnU/d9Gyi4mg+neLhJlRlRS5SQpqjGtPPYkWbKSsn0cCyE4Wot6TLd2sE/fXV/HWi; 3:+vIl9TNWQ31dRlXJ7uoJWBOCANy7OPDVM0EeBXkKdF60Lv/06DWGnRX7ZjkXSQ/9PV05TqNSo4dqbRv6TgvCoJ10+DxYyKHlYCJYHu7x+HQSU9ASozN0vTCTYqLNnvAM; 25:gfEbnT1UOPTlntXrkZlPFw0bx6jVmoYH0piLWYGfFeIlPfLvuma3wK8GRpuxeA0iq37fD4OcpeTLBpZHeQ48e3z1fBS5Qwlxb+gCGAH9of+uf92lDvTayCiwmsM9F72etoJawzkkrcNfEiN+Rm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YQHUjqw1QcCBGhDngsjb/scUYSYOSNwVJQQqaMOQ15rMzbZKlSgKwbMi7S25N56hwCoLVNlDr1m8N1JA5oFMhgZPMdo2PQI1/2YGRM0p3C8gvQ+CfhFE1u3vaERLF+K9S1KX79egL8pT0rZkooJRhegnJG4exNPcH2ygp3CaQnt7A4dipnd6NeheMJNCra0vGE8p95zrefgJsqogclNofldrVfUUuignjRdNi1L1WwyD3AxZUfgrB4rTtrKc+9Ab9mItPQlMLZoH4iKT/kPLEbA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:BN3PR04MB2211; BCL:0; PCL:0; RULEID:; SRVR:BN3PR04MB2211; X-Forefront-PRVS: 0937FB07C5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(9170700001)(110136002)(107886002)(450100001)(48376002)(50466002)(2906002)(19580405001)(5008740100001)(47776003)(66066001)(19580395003)(53416004)(586003)(3846002)(77096005)(50226002)(6116002)(50986999)(36756003)(189998001)(92566002)(5004730100002)(42186005)(2351001)(229853001)(5003940100001)(81166005)(33646002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR04MB2211; H:dispatch.fios-router.home; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3PR04MB2211; 23:Z4jJMt8pV/MLS+oRvweAI1RoqxSqNZSlB8sk8HrJVLD2jgqyrkX7h7DGpvnpX/3Gkc5R8k+QnHr3PYEK/yxqvA62TbwTN7WEOPbTKPVQgn/6F/JtlgysqiIecKDF4gZs39ViuDdVGTes8U4sCTzrsuVQ3ocuM2wnC+ysbEMfQVVZm4/pZRDROsEeNJv8klh6sTrRJ2JIa/D9SWe4eDJ8l7d8mlPcr90TAqzxgNWv87gY3o+1VdnihPlGCp4bMbBly/GfNyIPnBRj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AvZDROMlYrY0OUcMDnhxevx4OWDy0ZBBNHf99ijMdq2xH5JKswy+d8G59CVj8CP8T8zseaFBB4xGgASBMLmzsgEwsb3dNyvWQAraqFGwt+4Yz28kEZYqleXz9FZHh0uyHaAGo4mL7NDsGLV/NFcwT+hZA8=; 20:r8OvZ0W9BIvTf65PbQJCRO3smcP5BiPtvTEuvh38oQH2IpUkgQcsAACG7ubCADmzR8OWp4QM7aUSAD69TJtK11KR7GR+ntHsieXrgbQP1lRrOlwKb+aMGUe8PpoPtyGJ5FE7aMqJjGdbg3NDk2eFuROxtNUFhBMIzvB9fk/XRHgA8ToK1iyNLxuoFwogpFdiD2GEme+fMkbxtHUloxLGtHTnJeusfy7SAAyZZzMstHREqPIBnVu3bA4AE2McwiFx SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2016 13:14:46.7841 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR04MB2211 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A 'struct bio' is allocated in scrub_missing_raid56_pages(), but it was never freed anywhere. Signed-off-by: Scott Talbert Signed-off-by: Zhao Lei --- fs/btrfs/scrub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 82bedf9..607cc6e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -2130,6 +2130,8 @@ static void scrub_missing_raid56_end_io(struct bio *bio) if (bio->bi_error) sblock->no_io_error_seen = 0; + bio_put(bio); + btrfs_queue_work(fs_info->scrub_workers, &sblock->work); }