From patchwork Wed Feb 15 21:49:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9575161 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 B2D0F6045F for ; Wed, 15 Feb 2017 21:50:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A638A28544 for ; Wed, 15 Feb 2017 21:50:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B1B62855B; Wed, 15 Feb 2017 21:50:08 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 71F5D28544 for ; Wed, 15 Feb 2017 21:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750806AbdBOVuH (ORCPT ); Wed, 15 Feb 2017 16:50:07 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:46293 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750719AbdBOVuF (ORCPT ); Wed, 15 Feb 2017 16:50:05 -0500 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1FLioNn016765; Wed, 15 Feb 2017 13:49:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : subject : date : message-id : mime-version : content-type; s=facebook; bh=DL/KJry62kLGT3CEk1kbbSOWFEuKnx43g00B4a+Hobg=; b=LVWDkIpO3J2v5UyWu8LvVWmAw6HrWFRDsAV/yyjPb5oqJTlEWYPs9hXUipEoekeP5qAJ HVzLxISGm27+Pk0BIEPIZF9l3TOxrqnO4HNc0gJckdss0X3svjPxErnBnlxSUH9eYxvv wAWf35IRfMXoRyge2s+2v50hCJ9ora1r0pM= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 28mwq8gc9w-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 15 Feb 2017 13:49:57 -0800 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.27) with Microsoft SMTP Server (TLS) id 14.3.294.0; Wed, 15 Feb 2017 16:49:55 -0500 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=DL/KJry62kLGT3CEk1kbbSOWFEuKnx43g00B4a+Hobg=; b=hS+/JQrgARUOCR+J/XuoIUu2FcLWsltSdBrds/l+Nb4gRHOtcNE3nwfsR8YgNHl6LWrtyARDT7v+NvXvgLWwXJ/fIDgsxJwdO9Qf/elRjDBYT54bcgC8rKqOMOrdf0J2RBFpDbfDAgOrFZDB+WczgU3uJooW9014lCSj7ah7NWg= Received: from localhost (2606:a000:4381:1201:225:22ff:feb3:e51a) by DM5PR15MB1913.namprd15.prod.outlook.com (10.174.247.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 15 Feb 2017 21:49:53 +0000 From: Josef Bacik To: , , , Subject: [PATCH] nbd: cleanup workqueue on error properly Date: Wed, 15 Feb 2017 16:49:48 -0500 Message-ID: <1487195388-28532-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [2606:a000:4381:1201:225:22ff:feb3:e51a] X-ClientProxiedBy: MWHPR02CA0014.namprd02.prod.outlook.com (10.168.209.152) To DM5PR15MB1913.namprd15.prod.outlook.com (10.174.247.141) X-MS-Office365-Filtering-Correlation-Id: 8bf4ee18-db9b-42eb-42c3-08d455ec9366 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM5PR15MB1913; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1913; 3:ZYpiIFazQqYO0JhM4pVFIm+pIowX9/8fhJfNBfk2vCaiKW0aY6ZTzE7j+zJFuOaDhGCEOsAVVlzXVEg7DbwiVfkFsDf3vAYo+mkYcMyHh/WRwVVAKGxR3vySLInx8OKHtYkHJKYGtmdehf9/tprR2ER/433W/eH4bMdYUkZ79ld9Hb+PgBPfSlbfOZ3lqm66lPU2teIt2Ep9ypdVuSBUmeGuUcJAw4ZRJ4ByyKskGpula5XOPMh/id0gpYesYsblpfAL/Yw1d3oKar4k0v66CA==; 25:Q/6+wyEGfJ9Y/W4anxB1w8XeJFNWKRVppkEU+8luon6CYptpGWxGcJNFOiHCUybeBPcyWgeDc2TzrToFr6t9L64tNByghM18Yatm//eyo2mRwvO3dC83wiMB0O+ywexXV6dKIegnZEpLIuYT42Av721mbk+qD4XYCBg/nLKZ2C2KVKwDOvJGqrwWo06MdHL8YgTFJs84B/bA7Mo2meRJ7tzsqxWZbwPN9VUYH5j6MiPUScSrDZIlscxI2Mu5qz7F69o6J9QF7bRMP8xd8GSMClB+oRG0Nyugjwq8hgR7imzbt0ZwqiG1lE0Q6TbWJImiDFl2LE9e8lM9v/Al6F07yS4kiPhJaXY6q2Wkkz/ghjY2zsL9a6t73XF+El51g+7aj/jfyWrBO83cD3iGbh9tXeoVjCdoCEADzuGOKgm+mrROmSjicHsI3//Tz6kOxV7wn5rPnzCzP3xCr/dCGcIp7w== X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1913; 31:VEtUoQi8tjT4GV/TyiFaKJ2WI82GANUMJmvJCyK0NT4a/+9EMWvG1d69bTl1ntp0mQqSQWhmPYSK5Vr6I2N7xyHGFKMBPGVR4IpII0XddMtkyiLQ6hzCDjXZvgBKIJ4Dp+y/x/D3BRNJEXif6a7iA3W4Vr5MVtCyc6DC7rzt1WfHv0U8wdk2SCK7dhyQWtr3qYRD/vypJy6QOtcBL6bz+JYQYx0MUJ+lyrShMML1OPCgM5Kx0JQFSAWhnjFPy97Q; 20:iC4/drqfdba+UAQTEQJqhUyS8u/AmxF6Jb57R1ArwFqHAsM0tUsLlOr9zFOAlNWdEkb9WaAP8n1jq2fBcf+5swje34/7/DFDcag9C0tA3/7C3G+HzlCmd+Bih4CnwyzA2qUJB1+M9aTGgQjmvBzT9EuNdAw26fK+zOuyYMq6WUwrzdnggypaosG7TItjjMfyQK0zizj9SJFbR5qnkUfgBzO3b50Ni7vTz34IToa8JbjLAjujskfLRKvnMm+GhVmhOZuB4tbI7DUr7vjdrh/wPLW4Dl8fSOy0ikYjLfcFTPurxPukswRxqBsVuAoq3rP9kfrsD+0tmjAutSnM6toe9rbVrfqmAT/B3P+NaYyDb1e/luSA5ppTlEV0X9AiZBH1N5Qy0aFY4jT1wCFsWgBdD+VbVuDSZncsg20k4XQ1z0kJHcnJTZJ+Bvia2Y2O891oyedLoQVNroXEFTv1CX7JUr7rhZChm+SJvQTMwuRM1emF8w//YIPCyGuk5eXgQz94 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123564025)(20161123558025)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:DM5PR15MB1913; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1913; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1913; 4:HOWlWp7F+0wtNala3NlaVCeU3QmrHmDvCp9wPo8Mh6FuCE+PhO/wpMgoDipBIV+uzC/OdPiUGe3H6k4CQj/obJOSAticoWa0Nm0N9cD5m53M9MP2W6OcUw+NT6vWSmxaJmVnhmB5WMDPCRvkKUJ9ivKiPpdmlAk2OLbGrvNofAOWI7sN3H0AG0+QFmLNGCCqovr1ONs0pgJiFJ6jZfgC63TqyF6V9jsNTmNl0cn8gSYqnF5aG8yMRo6Mku9/MWxOdHj4Zq58Ql3jyFvFSOOVPQZJazbMShFipb8KN1+2OMCPpYMudV7s6JHySPZ1umZKZOVG6MRHhWBLEqXSn5tafRU6/1t2TzJcrBRJdkbbhjKDRVrSKI5sEbAyBENzI8l4QYqf/rD6/hLoGIuGKNwbAvxf6G9GZSiv2GV62BGKyvONL/ft+3udrMDTDmcS4iYFYmOCikCDo/8K9P0rcxWNb/g/uGQnZchR0sy4Cwjm0K5ucI6auYfrhkS6Bxj4XMhIZqw3VS0tGh+7Q4hoXPrknVmg3RwCVpK7OA5sfT2QbM+Vw9dtjchs2jPakTT7j78C4y+o9fZ7E1duC0wbBjdZaoyFHG/pWvsG/UBMgNGSLvI1YpOTmzbEGppEwYmX2vTqnmWthpt5Uangn/W8XxzbFg== X-Forefront-PRVS: 021975AE46 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(7916002)(39830400002)(39450400003)(39410400002)(189002)(199003)(5660300001)(25786008)(5003940100001)(2201001)(7736002)(6666003)(92566002)(305945005)(42186005)(97736004)(6486002)(50986999)(68736007)(6636002)(36756003)(76506005)(189998001)(53936002)(105586002)(106356001)(101416001)(50466002)(47776003)(8676002)(81156014)(86362001)(2906002)(48376002)(81166006)(33646002)(38730400002)(6116002)(50226002)(6496005)(389900002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1913; 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; DM5PR15MB1913; 23:OP2krRDOHF0x9a9kRf+G37CH+Gc6KCtmQqsIgTts5?= =?us-ascii?Q?yUHpBbr3DBeV/TcK1KOdE+WLNYJfoniZEeyJ/lwM2CimI6T9JIna8KmCH3BQ?= =?us-ascii?Q?sW9t8aKGhYhGCv9dxIG/lbnNukBMzlBI76P8Rvy+8krOP+KwFXUqGCbN0WcC?= =?us-ascii?Q?QSBpulO3NZO1b9RBaFvxgO+MKAS/nxJC31BLEH4nwSjpuVMjEHuAIRBkAZMX?= =?us-ascii?Q?rH76VRL2qrFCopWpv7k4A//VSc6nWUHgFcD+R1mTfRgM+xtU8OndNwtvo5kC?= =?us-ascii?Q?Qqvb2nJBAHOL62lUhkCanI3JXujnPeSQhX5yxMFuA1NNkXHQqI4/sCAEBzRD?= =?us-ascii?Q?PcCDwDPTXZ20izCqBRRlVuhk5PALdD/L1oLlxjbIJq3GkNpKCpxyBtJ7Y9WN?= =?us-ascii?Q?emmGVzNPsqBnDQa6pD4lbKbJ23N850jqrdanh8Nv9/lWi6030F+nVEgTZnDg?= =?us-ascii?Q?PWe41priP7/ECGD9zSdCjHm/E/ERhe0wrfQ2slvb4UGyxFgjX9Uxy4w/23Ih?= =?us-ascii?Q?Hy1Ru+cBcBZYQb/hHYH7KigI+oIyOwDK6Mmjkxn2jQvbLDNqYH3QB2BWSSn+?= =?us-ascii?Q?x1V+IUW61qiVpkzijVz2aYSivc0cC6SS6bw0o1M5NC/orNgnQcEzveQWV7JT?= =?us-ascii?Q?FOWtWuLMTBDNsZKGnymEoap+7Z+UMzRnMZdgXWnX7oIZrwN/nuZGIdUOZFOD?= =?us-ascii?Q?rswwQtl9Hu5Bkm0jjy3T+5l9hiko4O+SSqzxRsR192ke3/GEY6b0j3XdPf/c?= =?us-ascii?Q?V5rM8H3d6vZQ21SblRIckc/I1djgX8xgGa6wroQwBwreZek2gB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pamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1913; 7:nvqT9tNcx/ihLC09oWJySyOePmZFHob7U7OoDUKMVxhWS1xfGdtBYrBvmHTKRPEDQ4IochHyMA6iobu7kBMhjZZDe5KqKOxId1cvp9FAUuzIlgNXaCodJL8N7X6xx9VxrpxUsO6B1DU5Ccf3jxUAnRun/XeCfVcFxdcmCAvvPQD7LadlcVNbQy+NkznDWYQg3CSVGP4hFwxY868qJeXgq2cjhFgstxo4GZE1vCVWv8mzDMhq39tb6akTkV6KxcPPsZ3RUyG40crUF7dX0xVeXDMuv1Ql1hS8JaoRusfVaPx41Gt85HLaHhmx7AAIIJhpyKLZP9qOFys3BUGo5qs/Gg==; 20:Yc7sPZF6dYnMQCBulBUKKTQjr0FQynX86H8mHze3ZSLY+IgCWmRQdZYXIyQaCTONPV2CQ4hAHgSW6GOyTmArCf6TNyLTPwnGvmVo9grD4bWd3jCUxWUAiWDvtL5ctpfW6fx+/blSDlMtSALlhhQWVLqQBy3uQCoyQqjRK8WCZiE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 21:49:53.5934 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1913 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-15_11:, , signatures=0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we fail to register the blockdev we need to make sure to destroy the recv workqueue. Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 0623f8f..a032a00 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1271,8 +1271,10 @@ static int __init nbd_init(void) if (!recv_workqueue) return -ENOMEM; - if (register_blkdev(NBD_MAJOR, "nbd")) + if (register_blkdev(NBD_MAJOR, "nbd")) { + destroy_workqueue(recv_workqueue); return -EIO; + } nbd_dbg_init();