Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2685755lqt; Mon, 22 Apr 2024 20:12:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVyZWL7aMlIbwt931C8G+30V69LhLz47wSb6tGTJPhqlxv3JJH91AJHyX70hE3h7iFLkWp/u6ZPaCIxGkgQ2lTFYxOPuWO5ZVC6NIi9xA== X-Google-Smtp-Source: AGHT+IGRuC89/DBj2UfEAYpJMPCQJc9Zg9ZqROyAvQAS5cGPiQZs/zCtIl6xAXJiHfjBGeFvZyJg X-Received: by 2002:a05:620a:490e:b0:78f:1094:f5ab with SMTP id vy14-20020a05620a490e00b0078f1094f5abmr12829863qkn.39.1713841973896; Mon, 22 Apr 2024 20:12:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713841973; cv=pass; d=google.com; s=arc-20160816; b=mEQFGcfH0Hue+IreWH/yeomY1cKCkxbM8j0k+6uK9eBAHbhKuEFFlLi6fIIw6oMNq8 /EdyJ9jYmyW56AO43qyNUZbltBqlawhaBraDffLK4wEo+ibZM3bxVb30l5M8djPBHitT qpoBdhjrhlypKm9MDFddwEgWSBhDdnVfMEwuuNjGcK8gM96NP5rHhxWhAmtlo70gQUdE zJ22eNy3rOwTccu3ytdSOhfWoVEFuWg8W8t8ex/STOUVIxmd2iAdd8gzIiWfEZuQhp5x F5EVdPVAY/8HhIuJwQ8DkYHldTcvbvwv06Y3oMheVReDnLTlSx/irqvkYWoIzgi7p4o/ 6quw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=EL08xpwGisc4q476xwEH4g0LKuLk2SKDCtku78GMlno=; fh=v8xUtyFkmzGZMmWmAQ4FadTGq5GKhFfG2qkBWhr83JU=; b=ZINLtZkuo9w/j+UjMO1n45YItAwh6ZIHkdu9tbfzIz6B40NQpHhZqPHkSU5Os55qn/ KCP4aayUJH3DBXyF4h3kVMrEt/j86bvS3NIl1kGdrAhbPmZ4eTHJR1ySTo6by2BddO3g n+BzNYWyIhz5i4tTp4awkvYE03M62tnKbaPn3IwGsibCUixChoTCW+tBo77ThhH2T4WJ nhCES9apH1W+N9lYtvFTMCDRasZ70WpKJjgO/KthOAwj9vdn/B28hdN5M2wunUasS7fu 1FFpFNTbhOmv4jwfXb/QkF8UF2Kxv6sr/yFxIJAYUAwRQNft2MqgmRAtbaIvp1lBLkuK wc3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=iXSamUlo; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-nfs+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id oo16-20020a05620a531000b0078efb977d63si11600434qkn.162.2024.04.22.20.12.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 20:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=iXSamUlo; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-nfs+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2925-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8C8D81C2140D for ; Tue, 23 Apr 2024 03:12:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60CC618AED; Tue, 23 Apr 2024 03:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iXSamUlo" X-Original-To: linux-nfs@vger.kernel.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3E2618049 for ; Tue, 23 Apr 2024 03:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713841971; cv=none; b=srrJUwTWUNgHoSK8KxBmZbpo413wfUT0ncvHzBxqP4tvVAfJf6xB5N/DhXAc+Jws3Nrm8AFe2QN5Ju90uRt2fuGR0j3iUGlu2BnFQ7lxdQmTgjkvcc5C9j5Iv7oGO1YCNW/OeyJuEEBgkvaMIwSa3TU+brpq19S5h5SI/HmgMlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713841971; c=relaxed/simple; bh=XhUO1tt436EWYLvr2NFHeAYCECHX1TZvWeGtddLQJM4=; h=From:To:Cc:Subject:Date:Message-Id; b=PrcXvbYZ9w0Cu9krruHfmK2XjhTbCIJ/pqlzaCsBTa+mwBZvMhWUm8sSnilF8l3eSRiEos6sfCnoo2rLgw08NDNzI8Uz4vYd3U1ghYfrrAO/Er/3nAcrjJlC/QY6NPhabfESbQVm1mVq9kt/R//lX501RzUsrFmFLBYsvRR3COw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=iXSamUlo; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43MHnOoY013914; Tue, 23 Apr 2024 03:12:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2023-11-20; bh=EL08xpwGisc4q476xwEH4g0LKuLk2SKDCtku78GMlno=; b=iXSamUloakTYPHwZj2lFMC4r4MRfGUbY1tPjxS0THXvWixrN3PDjUKIBmBKV7AaVvCck 5hmhdvtoFCsidowccOaf13XDvZK2xf+ncywqABwuq3xE1g11MzXYkgZhLDePPnfumxX+ F+5bFrBHLMnLr7fjvWFwkdzDgWoQYAZWklFBJccRgkZK0rJatI0Aa2BZnM0Bh43Tmsmm Z9MCO1U3XZ6OSkuBS0R/UeT8baJYFVg65er2lzuLB/TjUcpDPLcfs2mG0utk0prStYlS gMhSYKzrPCEW+vjbHrbKlcGDzuD4Fxu/wAVK/fnEu995agXfYqwSuuZJ8zfZUY1NI5zG Xw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3xm4a2c4gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2024 03:12:46 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 43N0eIdL040675; Tue, 23 Apr 2024 03:12:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3xm456j41y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Apr 2024 03:12:45 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 43N3CjTj016779; Tue, 23 Apr 2024 03:12:45 GMT Received: from ca-common-hq.us.oracle.com (ca-common-hq.us.oracle.com [10.211.9.209]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3xm456j41v-1; Tue, 23 Apr 2024 03:12:45 +0000 From: Dai Ngo To: chuck.lever@oracle.com, jlayton@kernel.org Cc: linux-nfs@vger.kernel.org Subject: PATCH [v2 0/3] NFSD: drop TCP connections when NFSv4 client enters courtesy state Date: Mon, 22 Apr 2024 20:12:30 -0700 Message-Id: <1713841953-19594-1-git-send-email-dai.ngo@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-23_02,2024-04-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 suspectscore=0 adultscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404230008 X-Proofpoint-GUID: 8ll8Wi6QWoxWoIegxmHY9EXaEjqBHGA8 X-Proofpoint-ORIG-GUID: 8ll8Wi6QWoxWoIegxmHY9EXaEjqBHGA8 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: When a v4.0 client enters courtesy state all its v4 states remain valid and its fore and back channel TCP connection remained in ESTABLISHED state until the TCP keep-alive mechanism timed out and shuts down the back channel connection. The fore channel connection remains in ESTABLISHED state between 6 - 12 minutes before the NFSv4 server's 6-minute idle timer (svc_age_temp_xprts) shuts down the idle connection. Since NFSv4.1 mount uses the same TCP connection for both fore and back channel connection there is no TCP keep-alive packet sent from the server to the client. The server's idle timer does not shutdown an idle v4.1 connection since the svc_xprt->xpt_ref is more than 1: 1 for sv_tempsocks list, one for the session's nfsd4_conn and 1 for the back channel. To conserve system resources in large configuration where there are lots of idle clients, this patch series drop the fore and back channel connection of NFSv4 client as soon as it enters the courtesy state. The fore and back channel connections are automatically re-established when the courtesy client reconnects. v1 - v2: [patch 3/3]: a more reliable way to check if the connection needs to be dropped. fs/nfsd/nfs4callback.c | 14 ++++++++++++-- fs/nfsd/nfs4state.c | 32 ++++++++++++++++++++++++++++++-- fs/nfsd/state.h | 2 ++ 3 files changed, 44 insertions(+), 4 deletions(-)