From patchwork Fri Jul 21 14:48:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9857099 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 7C6FE601C0 for ; Fri, 21 Jul 2017 14:51:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E1C287D1 for ; Fri, 21 Jul 2017 14:51:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BCD9287ED; Fri, 21 Jul 2017 14:51:25 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 D1C99287D1 for ; Fri, 21 Jul 2017 14:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753111AbdGUOtW (ORCPT ); Fri, 21 Jul 2017 10:49:22 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:37849 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753828AbdGUOsV (ORCPT ); Fri, 21 Jul 2017 10:48:21 -0400 Received: by mail-qt0-f193.google.com with SMTP id n43so6515695qtc.4 for ; Fri, 21 Jul 2017 07:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XKXDpXHJKfiuSZAH+u1KI0vBDnH2hOndUrLIGCot9bc=; b=UgONz0p1VO38K49elL36zXDCl/kauZxyGmeRVSZ5PzTaVrO3Rb/AcLjBV1GkTUwKga iyFOLVM+qs+7o1MjGtUn0LRWOqD5uABWF8XsW52qwNdQKuZCNosmghP0lBe7O1aHWVw/ 0eQIhnm2kE2Q+4C02sxEtgWb/KlcEaTlK35aM4MCxCnZOIYtWMuoDcbRSDierRATFYZl pmOWgt42N0sQBpJYlPI9RjDEfF+E1iFuk/PKOuNdVMVb5sTzL45V7euuBeACle/pgrNe 2b1kpm0Z7XvZ2TituiglwpRX1vP3+VHFi8eIVxiUuzucXBjrymJYlKgiIKoCzDZZgLGO opQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XKXDpXHJKfiuSZAH+u1KI0vBDnH2hOndUrLIGCot9bc=; b=ajnrpkMXgjjZTLMwMNKb4apUIvzJc2YoOXBtK51lvh9IU3rf9vQZwxX3rt8+cpjs3o w32qiQKk0f5ANSic8rDX3FC0HglKzk70FHCDEdJXVQArnm7hm6REQ6ILc1IqOHXdQ2+i Tiies0cKUA+umI1EUOCze7/YE1SzPOUsGc38xdA1+LkCYWcq56K5X3z4mk9niGnXkJjg WyJ7Dr7/oHZZBxrqksdu0YiSdcpCBeHyfm90oNrmKz2XobOvYdfuVmY2V7nDqxwGTSwJ yUkXxRvruHvQznra2b+Cur9gO39muJr/a8l+lKZgqfkYGsn0w/tPH33NLvpcydvpeNyQ W+/A== X-Gm-Message-State: AIVw1108CQ2+zgw45HpyChZU7LnyE84cYMA3X3057CBtdbVK6okOK7fP syoodFKbKuNR0mhrXzvFzA== X-Received: by 10.237.56.40 with SMTP id j37mr10345755qte.45.1500648500955; Fri, 21 Jul 2017 07:48:20 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id m123sm3428933qke.12.2017.07.21.07.48.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jul 2017 07:48:19 -0700 (PDT) From: josef@toxicpanda.com X-Google-Original-From: jbacik@fb.com To: axboe@kernel.dk, nbd-general@lists.sourceforge.net, linux-block@vger.kernel.org, kernel-team@fb.com Cc: Josef Bacik Subject: [PATCH 3/3] nbd: only set sndtimeo if we have a timeout set Date: Fri, 21 Jul 2017 10:48:15 -0400 Message-Id: <1500648495-13337-3-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500648495-13337-1-git-send-email-jbacik@fb.com> References: <1500648495-13337-1-git-send-email-jbacik@fb.com> 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 From: Josef Bacik A user reported that he was getting immediate disconnects with my sndtimeo patch applied. This is because by default the OSS nbd client doesn't set a timeout, so we end up setting the sndtimeo to 0, which of course means we have send errors a lot. Instead only set our sndtimeo if the user specified a timeout, otherwise we'll just wait forever like we did previously. Fixes: dc88e34d69d8 ("nbd: set sk->sk_sndtimeo for our sockets") Reported-by: Adam Borowski Signed-off-by: Josef Bacik --- drivers/block/nbd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 6aefe9f..64b19b1 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -908,7 +908,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) continue; } sk_set_memalloc(sock->sk); - sock->sk->sk_sndtimeo = nbd->tag_set.timeout; + if (nbd->tag_set.timeout) + sock->sk->sk_sndtimeo = nbd->tag_set.timeout; atomic_inc(&config->recv_threads); refcount_inc(&nbd->config_refs); old = nsock->sock; @@ -1077,7 +1078,9 @@ static int nbd_start_device(struct nbd_device *nbd) return -ENOMEM; } sk_set_memalloc(config->socks[i]->sock->sk); - config->socks[i]->sock->sk->sk_sndtimeo = nbd->tag_set.timeout; + if (nbd->tag_set.timeout) + config->socks[i]->sock->sk->sk_sndtimeo = + nbd->tag_set.timeout; atomic_inc(&config->recv_threads); refcount_inc(&nbd->config_refs); INIT_WORK(&args->work, recv_work);