Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1222528ybd; Wed, 26 Jun 2019 13:31:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXl/dRDF2LujyQXESX2NSymt8/30fzCBIX6naVreFAXrPtGE7HqDB2re7xGt2QK2DI7INU X-Received: by 2002:a63:fc52:: with SMTP id r18mr4151323pgk.378.1561581077636; Wed, 26 Jun 2019 13:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561581077; cv=none; d=google.com; s=arc-20160816; b=qYQ3Kq1l/Unnf53SJ1yUiUvsOCvqT7/Wy3c03nvtsRd8FMjDh1Zx8OTb0umrjBOwMZ c5h2SVic5lyTkhAGTbEAiBHfrsH3LfTVnXWOcc3wAeU8M438WOrEe+o7S64WNogBhH0J AVt/XTXHofLovpEwzTWDu60PyUKRYaB1LSlRNtQic2q/+pLHr0/TPu1Hg1OhRL9ryCZK I89bfyIvwLKpHsMOf6jtDZx9PzG/DRCHCHEh3xxR+DEylRpaPkaRF13j6p+bKFckOPi6 kmh4wtqFqwwt0iw1taEq+R8i5/nmZWm6E4Ifw4ROT/b0ZMGfAO4n3Kiq3ac+Rfe/Qa0k vmBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4oJFjEKQXui2sQCmg7TVpy0FvZ3W9J+FTpKFzONYWdU=; b=0rfgcGDXSIumIOcwzRhDHeAUwq8UlyypDCSpdJGA3lBqUchF/olfbVzUk4hOAe18zb fFyxJ9CsK+ZgSIynkkJ9s00ZVFUyUic5Geb5eqEgXwU9nidMwfIIwDa2aByyClrJ0ahp bhZlvLDhqL4bt8YRty3LiV2iaSjXENOc+KS5O1llkLXaKoBD33Qq87dVLgL1qVOubAzT SykxszA5l0/5DTAbmbMpCQ4ZgebJzFHtRJrIZLutbm4YW0OKMr2JlAKx8rFylbKIWZfU iYt+Z9lT13/ts4J/8b+xermkCfAqaBrHa1P6Ug8tfKS63E2Wc6pBbrFDrvoyr6vtX3YL Vx2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12si40461pgs.34.2019.06.26.13.30.54; Wed, 26 Jun 2019 13:31:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbfFZUab (ORCPT + 99 others); Wed, 26 Jun 2019 16:30:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57818 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfFZUab (ORCPT ); Wed, 26 Jun 2019 16:30:31 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A648C308794D; Wed, 26 Jun 2019 20:30:26 +0000 (UTC) Received: from dwysocha.rdu.csb (dhcp-12-212-173.gsslab.rdu.redhat.com [10.12.212.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B37260BE5; Wed, 26 Jun 2019 20:30:25 +0000 (UTC) From: Dave Wysochanski To: trondmy@hammerspace.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH] SUNRPC: Fix possible autodisconnect during connect due to old last_used Date: Wed, 26 Jun 2019 16:30:24 -0400 Message-Id: <1561581024-28238-1-git-send-email-dwysocha@redhat.com> In-Reply-To: <566e3eb7b501d48a2989461c316b66c03c56b129.camel@hammerspace.com> References: <566e3eb7b501d48a2989461c316b66c03c56b129.camel@hammerspace.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 26 Jun 2019 20:30:31 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Ensure last_used is updated before calling mod_timer inside xprt_schedule_autodisconnect. This avoids a possible xprt_autoclose firing immediately after a successful connect when xprt_unlock_connect calls xprt_schedule_autodisconnect with an old value of last_used. Signed-off-by: Dave Wysochanski --- net/sunrpc/xprt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index f6c82b1..871b904 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -750,6 +750,7 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie) xprt_schedule_autodisconnect(struct rpc_xprt *xprt) __must_hold(&xprt->transport_lock) { + xprt->last_used = jiffies; if (RB_EMPTY_ROOT(&xprt->recv_queue) && xprt_has_timer(xprt)) mod_timer(&xprt->timer, xprt->last_used + xprt->idle_timeout); } @@ -1774,7 +1775,6 @@ void xprt_release(struct rpc_task *task) xprt->ops->release_xprt(xprt, task); if (xprt->ops->release_request) xprt->ops->release_request(task); - xprt->last_used = jiffies; xprt_schedule_autodisconnect(xprt); spin_unlock_bh(&xprt->transport_lock); if (req->rq_buffer) -- 1.8.3.1