From patchwork Mon Jan 10 18:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dai Ngo X-Patchwork-Id: 12709043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD789C433F5 for ; Mon, 10 Jan 2022 18:40:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241481AbiAJSkm (ORCPT ); Mon, 10 Jan 2022 13:40:42 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:47096 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241479AbiAJSkm (ORCPT ); Mon, 10 Jan 2022 13:40:42 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20AI7XDp014709; Mon, 10 Jan 2022 18:40:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2021-07-09; bh=V/2GGaBTZ1c7p3laThIUnq01Gf+Z9U2NvjfsLnj48/g=; b=fHDdovb4czKahReVeHJMZILQZ0WJfqmzqAx+4TNjuOiqZfZtvR25sub1i9wGTgad2WFB q59lek8hUtUlEFYMV9sql3xCWCG+xki5r2oD6wxQDaT58z+5m4PjvVJKnd4i5ATAolXS saSfL1ETlJ3HbVVUwHs1q+/uf8DShfn3PD39oMDYntbwSM4bQuvlcpsopk9y2haL5cF0 fauNzbDlfGWMK5vwSyUQoS0kLsmjAL3maRlZQarQtEUJTk07sNPcTm9iuboBzOF8HiYL RB2eX1ZmZpNmw+Z6YU7DoRdLYshK6v8W6UAIcFccATzVZzOdrXB2oONlxz9MaUS+m+YS Hw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3dgmk992c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Jan 2022 18:40:39 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 20AIePVT063590; Mon, 10 Jan 2022 18:40:38 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3030.oracle.com with ESMTP id 3df0ncxjd9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Jan 2022 18:40:38 +0000 Received: from aserp3030.oracle.com (aserp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 20AIebwx064436; Mon, 10 Jan 2022 18:40:37 GMT Received: from ca-common-hq.us.oracle.com (ca-common-hq.us.oracle.com [10.211.9.209]) by aserp3030.oracle.com with ESMTP id 3df0ncxjcd-1; Mon, 10 Jan 2022 18:40:37 +0000 From: Dai Ngo To: bfields@fieldses.org, chuck.lever@oracle.com Cc: jlayton@redhat.com, viro@zeniv.linux.org.uk, linux-nfs@vger.kernel, linux-fsdevel@vger.kernel.org Subject: [PATCH RFC v9 0/2] nfsd: Initial implementation of NFSv4 Courteous Server Date: Mon, 10 Jan 2022 10:40:27 -0800 Message-Id: <1641840029-20972-1-git-send-email-dai.ngo@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-GUID: YTqr7aI8P1MsfOX3mngAaD9xTmaaZjyY X-Proofpoint-ORIG-GUID: YTqr7aI8P1MsfOX3mngAaD9xTmaaZjyY Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Hi Bruce, Chuck This series of patches implement the NFSv4 Courteous Server. A server which does not immediately expunge the state on lease expiration is known as a Courteous Server. A Courteous Server continues to recognize previously generated state tokens as valid until conflict arises between the expired state and the requests from another client, or the server reboots. The v2 patch includes the following: . add new callback, lm_expire_lock, to lock_manager_operations to allow the lock manager to take appropriate action with conflict lock. . handle conflicts of NFSv4 locks with NFSv3/NLM and local locks. . expire courtesy client after 24hr if client has not reconnected. . do not allow expired client to become courtesy client if there are waiters for client's locks. . modify client_info_show to show courtesy client and seconds from last renew. . fix a problem with NFSv4.1 server where the it keeps returning SEQ4_STATUS_CB_PATH_DOWN in the successful SEQUENCE reply, after the courtesy client re-connects, causing the client to keep sending BCTS requests to server. The v3 patch includes the following: . modified posix_test_lock to check and resolve conflict locks to handle NLM TEST and NFSv4 LOCKT requests. . separate out fix for back channel stuck in SEQ4_STATUS_CB_PATH_DOWN. The v4 patch includes: . rework nfsd_check_courtesy to avoid dead lock of fl_lock and client_lock by asking the laudromat thread to destroy the courtesy client. . handle NFSv4 share reservation conflicts with courtesy client. This includes conflicts between access mode and deny mode and vice versa. . drop the patch for back channel stuck in SEQ4_STATUS_CB_PATH_DOWN. The v5 patch includes: . fix recursive locking of file_rwsem from posix_lock_file. . retest with LOCKDEP enabled. The v6 patch includes: . merge witn 5.15-rc7 . fix a bug in nfs4_check_deny_bmap that did not check for matched nfs4_file before checking for access/deny conflict. This bug causes pynfs OPEN18 to fail since the server taking too long to release lots of un-conflict clients' state. . enhance share reservation conflict handler to handle case where a large number of conflict courtesy clients need to be expired. The 1st 100 clients are expired synchronously and the rest are expired in the background by the laundromat and NFS4ERR_DELAY is returned to the NFS client. This is needed to prevent the NFS client from timing out waiting got the reply. The v7 patch includes: . Fix race condition in posix_test_lock and posix_lock_inode after dropping spinlock. . Enhance nfsd4_fl_expire_lock to work with with new lm_expire_lock callback . Always resolve share reservation conflicts asynchrously. . Fix bug in nfs4_laundromat where spinlock is not used when scanning cl_ownerstr_hashtbl. . Fix bug in nfs4_laundromat where idr_get_next was called with incorrect 'id'. . Merge nfs4_destroy_courtesy_client into nfsd4_fl_expire_lock. The v8 patch includes: . Fix warning in nfsd4_fl_expire_lock reported by test robot. The V9 patch include: . Simplify lm_expire_lock API by (1) remove the 'testonly' flag and (2) specifying return value as true/false to indicate whether conflict was succesfully resolved. . Rework nfsd4_fl_expire_lock to mark client with NFSD4_DESTROY_COURTESY_CLIENT then tell the laundromat to expire the client in the background. . Add a spinlock in nfs4_client to synchronize access to the NFSD4_COURTESY_CLIENT and NFSD4_DESTROY_COURTESY_CLIENT flag to handle race conditions when resolving lock and share reservation conflict. . Courtesy client that was marked as NFSD4_DESTROY_COURTESY_CLIENT are now consisdered 'dead', waiting for the laundromat to expire it. This client is no longer allowed to use its states if it re-connects before the laundromat finishes expiring the client. For v4.1 client, the detection is done in the processing of the SEQUENCE op and returns NFS4ERR_BAD_SESSION to force the client to re-establish new clientid and session. For v4.0 client, the detection is done in the processing of the RENEW and state-related ops and return NFS4ERR_EXPIRE to force the client to re-establish new clientid.