From patchwork Tue Feb 2 01:01:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1434378 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=txx7Qe/q; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DV63Q0dwcz9tkl for ; Tue, 2 Feb 2021 12:02:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229736AbhBBBBy (ORCPT ); Mon, 1 Feb 2021 20:01:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbhBBBBx (ORCPT ); Mon, 1 Feb 2021 20:01:53 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6239C061573 for ; Mon, 1 Feb 2021 17:01:12 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id d2so1287545pjs.4 for ; Mon, 01 Feb 2021 17:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V0izvOuTNUtald5IcD/J2tYB96vc7/LLzt4ew9Ak4hQ=; b=txx7Qe/qTRpke0lYFwUZS6C7YZpw2G7fR38IoagAjJiRj/o7lF1A6ycyF2jXkZzoPm Y1Aoei1PdEUi5NRhF5nniOThtudjCR8HVLf0Q3MuqPJrXJxbuEpfM1J+4wmCVC2Q8rh1 5OlGaOc/pvB5xghRiBVLAG/aVwY7y+IovjwxIfuIJovYUWIxfuqP8jYHixdtQRX94pzc ZO0h85YaYamHbwETuXEty3EmoC6+llBfxQjxxhm5+GtYCOeiKjFtagwP5r3ukKZOyx6J PdIovFIhHXHpN8f9p+i9IQBEaN0XDqRpBu6xN9tH0hqIOfPiSpvkRfibRkNxg7TpsDE7 95TA== 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:mime-version :content-transfer-encoding; bh=V0izvOuTNUtald5IcD/J2tYB96vc7/LLzt4ew9Ak4hQ=; b=Kgxz/0YhOFAfxc3Ujsjbk77nBiKtDoh0iBiBGnPRLkTIln+8OZKXCevo4KhYFJDLcR lLs/3zlE+zohgB54CCRo0h/TR9d2/dtGg3i8GPVNFSHvyy3ia4Wepxsb0PVx4KNOwVeC fTl5re0JIdwxfNJOM8WYY9i9qUjbJVpqnQoEHdH5mFwSuxFCsbsYYSoP2LwJKJy20e4/ aRt8ryW5PEY1BiZ743uyId/wYk7rj9RyVxz6hmSqzVU6ypTsgzs9E0FjmgxysqRVS77n JKB+Qey++JBkEOz5wFXtPJGU03bdY1/Ed2Z+4GyTm+APgQH+JuWfy9mXefz2LO75OFCX 1YeQ== X-Gm-Message-State: AOAM533STPjPzeb0fVu2fmNy4r92mV0dC4ECYldnZjcfjOD6AdXkeZYc Dz6c9LK0vDVt7vVfYg7ZJw== X-Google-Smtp-Source: ABdhPJxPbMeTUZDblpkYuqp7LWBoK0Yl5RuxnFiUCv7rTtQy2AK/M0ldXS5BLfPxLUYR04Q1jtWyqw== X-Received: by 2002:a17:902:12c:b029:e1:aac:e6f4 with SMTP id 41-20020a170902012cb02900e10aace6f4mr20163008plb.26.1612227671632; Mon, 01 Feb 2021 17:01:11 -0800 (PST) Received: from ubuntu-vm.mshome.net ([131.107.159.234]) by smtp.gmail.com with ESMTPSA id h190sm19730080pfe.158.2021.02.01.17.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 17:01:10 -0800 (PST) From: Pavel Shilovsky X-Google-Original-From: Pavel Shilovsky To: Steve French , Shyam Prasad N , Ronnie Sahlberg , linux-cifs@vger.kernel.org Cc: Pavel Shilovsky Subject: [PATCH] CIFS: Wait for credits if at least one request is in flight Date: Mon, 1 Feb 2021 17:01:05 -0800 Message-Id: <20210202010105.236700-1-pshilov@microsoft.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Currently we try to guess if a compound request is going to succeed waiting for credits or not based on the number of requests in flight. This approach doesn't work correctly all the time because there may be only one request in flight which is going to bring multiple credits satisfying the compound request. Change the behavior to fail a request only if there are no requests in flight at all and proceed waiting for credits otherwise. Cc: # 5.1+ Signed-off-by: Pavel Shilovsky --- fs/cifs/transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 4ffbf8f965814..84f33fdd1f4e0 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -659,10 +659,10 @@ wait_for_compound_request(struct TCP_Server_Info *server, int num, spin_lock(&server->req_lock); if (*credits < num) { /* - * Return immediately if not too many requests in flight since - * we will likely be stuck on waiting for credits. + * Return immediately if no requests in flight since + * we will be stuck on waiting for credits. */ - if (server->in_flight < num - *credits) { + if (server->in_flight == 0) { spin_unlock(&server->req_lock); return -ENOTSUPP; }