From patchwork Thu Sep 8 21:12:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9322073 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 64F1660869 for ; Thu, 8 Sep 2016 21:13:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5658B299F6 for ; Thu, 8 Sep 2016 21:13:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B3BA299FD; Thu, 8 Sep 2016 21:13:17 +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 D9FB6299F6 for ; Thu, 8 Sep 2016 21:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757694AbcIHVNF (ORCPT ); Thu, 8 Sep 2016 17:13:05 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:42356 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757258AbcIHVMy (ORCPT ); Thu, 8 Sep 2016 17:12:54 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u88LAMHQ000450; Thu, 8 Sep 2016 14:12:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=IzTxvr9Uyuccb9g/ZHRDAzr8kU/oMR9v1SHsseIP+fI=; b=rMOZGcZc++BXLJidu9C32rEaG2CaYY3Zojym3nVFhXbzl7aGCX/zE8QDAl/Ud++ur8UY pBz7wwXY4a1UoF5Z01Ows88MwRzj0Yy9Yys3wY21tFiqN4EtXjquFrwMo9rUf5Uam24Y 4SQetCP0judhl7AuW1w+3BFNMcsAcPA7bwc= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 25bed8ge7d-3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 08 Sep 2016 14:12:45 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.15) with Microsoft SMTP Server (TLS) id 14.3.294.0; Thu, 8 Sep 2016 14:12:27 -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=bzkr9GUW2kJiGJW/iwEDqMhJT1wad/cb0Be+nWvhwd8=; b=A7fIvHpgCTEx5ozRLclk4MIzSMFBstcuFM7fQwW2CuHAY4j7MHAYZy044MVjB0wEbVil7a59OT650aHOkHwRP9PtWfKoFlsHqU4nn8ZJspZLbXl41KoCgGhhWgRmGKPRN+POx+jAJIczDbplKsgW5eBJ+07G2r7W6qnx4EOgIYE= Received: from localhost (2620:10d:c091:180::1:8c0f) by DM5PR15MB1324.namprd15.prod.outlook.com (10.173.210.14) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Thu, 8 Sep 2016 21:12:25 +0000 From: Josef Bacik To: , , , , Subject: [PATCH 2/5] nbd: don't shutdown sock with irq's disabled Date: Thu, 8 Sep 2016 17:12:07 -0400 Message-ID: <1473369130-22986-3-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1473369130-22986-1-git-send-email-jbacik@fb.com> References: <1473369130-22986-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [2620:10d:c091:180::1:8c0f] X-ClientProxiedBy: DM5PR03CA0020.namprd03.prod.outlook.com (10.175.104.30) To DM5PR15MB1324.namprd15.prod.outlook.com (10.173.210.14) X-MS-Office365-Filtering-Correlation-Id: 7f9ffa2e-a86b-49e2-aa95-08d3d82cd55b X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 2:iJy/n+AQQYUVt08jAmme7IcrVA2lo9nuiRfIz5e3x9Ru0OjXKdsFljk4jGMzQwWaA8YZj571F9e9PE1qKy6t9eiXeQv7Ch8AUOfhIrsGXxDyi83wJsJg9yrH9uVLUZqWvdMUWfCiAWs5eHVZL3QNQca8pBBrxuHM41mVU3V0DRbsaAKciacFU5bZbou278XC; 3:egVXYYR1UbcCc20HIReZadI1+46DUswz3/eeG2lyA3+A/kehrOOG+mokerx6s5dVvDwKWiOEMfB8BUcLMICnS9OqGPdHvjFv8GVju8zctxSbqp3p0Bx/RNZbv6+aVzx0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR15MB1324; X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 25:ODqzMJepiuAoZKvR/LNm9xbm1zgHQJXc18iBAaNZKYEVFASyYftqls0u/K+2Xkeo/KvU33NDB+L5xvvpggl+aoXNldoIrJ9Gm2MoDgm5T8/sitPSE75P7qNkm1ejneNVawoEmdCN/Z0GDpq3NN7upL8RFqPfY5dvyz8IN3r7a4F4DPd1bW9NJkhF1PYDuw7vXWJhOQxn5qE8ZGEPx+r/VR15IDKGkUa6hnDngg3VRTffMRTY0ba5xeiwwAXpRc0rByFUkgxopnDJ2cQkC3DFOs+E3BWfyr9JqEmfR9bvFOPFZpkFVX9hj/tHkWcXFlz0PC4Jrg0LXe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38pilrbYBbfeu23KlnTvIWD9PITf2d89CHU+rSySgtrLL8M69tZoI9582eBBIsrYdJDc0MW8qM/9XelYKuikI+r4AqkrlVfLsCwiZYO8fe9bzYotKc1vq6vpJWw3kfIwsaDJmXSABoqGxUEUvXKfGoO7zIXGzD3PZojtWTTyxUfRUJ/SB0Ya4r+OUw0pqqEEzirG5xUKbvWI6aq7kmTwFtYOeNaOCQaLH50vj/omBjW+qikhuDZ4XWMOxdEnP/FikfP 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)(3002001)(10201501046); SRVR:DM5PR15MB1324; BCL:0; PCL:0; RULEID:; SRVR:DM5PR15MB1324; X-Forefront-PRVS: 00594E8DBA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(7916002)(189002)(45904002)(199003)(575784001)(2201001)(36756003)(68736007)(86362001)(8676002)(76176999)(106356001)(77096005)(105586002)(97736004)(7736002)(5660300001)(81156014)(5003940100001)(305945005)(5001770100001)(50466002)(48376002)(47776003)(107886002)(50226002)(76506005)(19580405001)(42186005)(6116002)(2906002)(586003)(19580395003)(229853001)(92566002)(189998001)(7846002)(50986999)(101416001)(33646002)(2950100001)(81166006)(3826002); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR15MB1324; 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; DM5PR15MB1324; 23:AMW0rCACMvoxLCedTqmw8KMWztwcUHYUAZiebHzyH?= =?us-ascii?Q?1ZllMYkpNAfS7rLKFuoVQ35TF4YHvv/d1TNuq7S6ikg/WcpQ0Efvx5Te4S1H?= =?us-ascii?Q?p9du4Ym5hsBCYZsyPqocljoq8GU3YYhx2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YbhV/QoJhHiqegiNZWcCLjWWaFJ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR15MB1324; 20:LzpVULmUu9XP4fG4Qo+y7XFm5D6wroiE+MoyKhkHRv1VPIWp1VllgfOqjyaLMb6iWKqzKA9FTJ/KvpsLwv8Ne0enyKrWlNaxcmyO8xVpiRmiouF/Z/7t/HiPwA+Ozb+5Wq/gSIHdFbJhhOV9SRJUCMCbgXIHMIA0mpHkHlWWixY= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2016 21:12:25.6074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR15MB1324 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-08_10:, , 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 We hit a warning when shutting down the nbd connection because we have irq's disabled. We don't really need to do the shutdown under the lock, just clear the nbd->sock. So do the shutdown outside of the irq. This gets rid of the warning. Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 15e7c67..4b7d0f3 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -161,6 +161,8 @@ static void nbd_end_request(struct nbd_cmd *cmd) */ static void sock_shutdown(struct nbd_device *nbd) { + struct socket *sock; + spin_lock_irq(&nbd->sock_lock); if (!nbd->sock) { @@ -168,18 +170,21 @@ static void sock_shutdown(struct nbd_device *nbd) return; } + sock = nbd->sock; dev_warn(disk_to_dev(nbd->disk), "shutting down socket\n"); - kernel_sock_shutdown(nbd->sock, SHUT_RDWR); - sockfd_put(nbd->sock); nbd->sock = NULL; spin_unlock_irq(&nbd->sock_lock); + kernel_sock_shutdown(sock, SHUT_RDWR); + sockfd_put(sock); + del_timer(&nbd->timeout_timer); } static void nbd_xmit_timeout(unsigned long arg) { struct nbd_device *nbd = (struct nbd_device *)arg; + struct socket *sock = NULL; unsigned long flags; if (!atomic_read(&nbd->outstanding_cmds)) @@ -189,10 +194,16 @@ static void nbd_xmit_timeout(unsigned long arg) nbd->timedout = true; - if (nbd->sock) - kernel_sock_shutdown(nbd->sock, SHUT_RDWR); + if (nbd->sock) { + sock = nbd->sock; + get_file(sock->file); + } spin_unlock_irqrestore(&nbd->sock_lock, flags); + if (sock) { + kernel_sock_shutdown(sock, SHUT_RDWR); + sockfd_put(sock); + } dev_err(nbd_to_dev(nbd), "Connection timed out, shutting down connection\n"); }