Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1470989pxb; Wed, 12 Jan 2022 15:53:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2fKJEQRb/p1zb8JUW68k6yA+wHkLCzX7OYYKZGUeVLM9nqbD7Daluffg7jopscxMiST0Q X-Received: by 2002:a17:902:6b02:b0:149:7c20:c15b with SMTP id o2-20020a1709026b0200b001497c20c15bmr1723604plk.173.1642031601940; Wed, 12 Jan 2022 15:53:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642031601; cv=none; d=google.com; s=arc-20160816; b=bMVU9o24ozmjNUhvE+MUKBnnqw2WX5S9JRb6SctfTLu/ykGmq4nMbX30C7UkGIrhNl 1zR9xu65gEMWqo0H0J5kPxg2bjRo3Qs0s9V+Zpkh6L4DlNaXIgm/wy+MheBIWjdBUCJe O7XRwO8NG18Y6EHWkmiYi8qkXeTkItoT/33Mb9Drnr9wqDVG/iYZ9B2FxGo3N7XHfaZP vB2gjUMRYaz56aCZ4oKu2q78lC+bvUxDtxz6Dt1mbhl48ZDJIU4JxRVWRKPmRMo57mFp uGgGt7KgHR09q1wWrn27g5s0UeUOyt8x6jslob0e0UrMBfVup7vKW/JwUYpw+0ezTIvB 1tpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=UEx+SPRfUkIKxgfpDGYyp5QxigdRplxrHiTLz6uaY/Q=; b=yfMuFKrFxqR/8ziU0XimdA/mjylsGmKJb5RNCWBN4xI3UWTY3756p7xmULVyf7JpJh TbUbBMaSUe7KQiZjF0rljte6Ry4GdqkMgQddyqKtJkLdGPbjBwvVLepd7nteiV8pi/76 /c1mCOgaqf6O/9Mk0HyP8mJqS9QYngs30e8QGzswY5KWPhas3CqCTLTVKMehmY/2cgwH je/HgovIb6ZtBBly7lrm00LK+093TlNsiATX0B5jjDR4gQXcOKF/te/3JBQxiD0WMpqE OLxgf5s93J0V4mMhbsy3agyVL0l1RzSn1B6ou/vpCq2X6iMFtXJRLkpJj/H/GfJ4yLPR 5Sxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=QOqQjm5o; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si1200209pgh.203.2022.01.12.15.53.09; Wed, 12 Jan 2022 15:53:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=QOqQjm5o; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241317AbiALS7S (ORCPT + 99 others); Wed, 12 Jan 2022 13:59:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241281AbiALS7N (ORCPT ); Wed, 12 Jan 2022 13:59:13 -0500 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9650DC06173F; Wed, 12 Jan 2022 10:59:12 -0800 (PST) Received: by fieldses.org (Postfix, from userid 2815) id 353BE4C7F; Wed, 12 Jan 2022 13:59:12 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org 353BE4C7F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1642013952; bh=UEx+SPRfUkIKxgfpDGYyp5QxigdRplxrHiTLz6uaY/Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QOqQjm5obAv8VQDmsqRyUxkIXsmJvN+knJmVuHn1Rn43sixr3txCGPERODCdsc4OM WulEpcZrKRz5MW8LnXy+/ZA7qsqS5nCY+GxXpPPLSzhB/bX+/B8yTyxilFoTcGM3T9 ManaIqEYqtk8xvYqpqExP5XgK3mT56Ps788Xv6GQ= Date: Wed, 12 Jan 2022 13:59:12 -0500 From: "J. Bruce Fields" To: Dai Ngo Cc: chuck.lever@oracle.com, jlayton@redhat.com, viro@zeniv.linux.org.uk, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH RFC v9 0/2] nfsd: Initial implementation of NFSv4 Courteous Server Message-ID: <20220112185912.GB10518@fieldses.org> References: <1641840653-23059-1-git-send-email-dai.ngo@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1641840653-23059-1-git-send-email-dai.ngo@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Could you look back over previous comments? I notice there's a couple unaddressed (circular locking dependency, Documentation/filesystems/). I agree with Chuck that we don't need to reschedule the laundromat, it's OK if it takes longer to get around to cleaning up a dead client. --b. On Mon, Jan 10, 2022 at 10:50:51AM -0800, Dai Ngo wrote: > 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.