Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp849920rdh; Thu, 26 Oct 2023 18:56:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1i+xBSs3eY/gOwC7HHSez/nFOLAdLecH+XTRvWrG2pSbPmzIQKQ+im2IV5MT8rOvb1wgr X-Received: by 2002:a81:ed0a:0:b0:583:b186:d817 with SMTP id k10-20020a81ed0a000000b00583b186d817mr1230741ywm.27.1698371794037; Thu, 26 Oct 2023 18:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698371794; cv=none; d=google.com; s=arc-20160816; b=khUlHpWPuMk4XuhtvPPSmMeHUApdZZutHtq2UmOJEB6vagUNyC7MCrh7eg2acD9nvM 6DarMsf7L9rRoLsc2e3bySkMYwmNDPK7iRzIGO+9YCZCwHAB1bcIL6SvG9P8zJoc4j4J +50BXg/onRDNwcxX8iFsVQBcaV5bOVO0a+BsMuGlqSOgz2/mGWr7Kj7hXTfyR6F8d8Ku wsagQ6ELr26plPwlvcRYeDG6l4cwValcTAOtUmW73pCaqUx06lH77ZBlHM6Xjxgc5glp LbA27SaLG8PEl6ft3KJNP729IJd4XSIIeJw6vglmdWwtcheI+fRBi636bZqrpcXatkwT 1HrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=VgRrD8kcNH1PVooSLIMoBgqiyNQdw96No2zl9Hc7W1M=; fh=oGCWKUgN5rqvEqhxhGaFnCKhx0upqxg87fHnuYmJPFg=; b=0mK+JNPMxrysO2gnnxe9hpYSzTbWYmtSWV8a0xxXhxaU2pL0ER7TAw0kb31TV6km9q P7Kapd/z71M/0t+r6+HpTIPL1liNXJnpJRhEoKRFyqBo9NyYC/P1HM6vREmsjVDq8fop 3XREsTFd/yOebvL3hPM38IzWHTu/b8TDkYsFVxBqEjJkxccdOhmt1MVlY8PON/vRTEhW 7DxqHjeAGi5tUAdvT9zdVzW6aINrbW7AHS7XB02wSVfrPqbnCmR67p01TiiCn2TOZCcH xjHhi8qLZjXNJxfYf6HcHpJMJL6CJ8Nx/oY9avh5nXzM1qS0JWMRtTWlisNZOjOv/6mk jDSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=FvfKxZTD; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=I6v2OQwJ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i186-20020a0df8c3000000b005a21c268f18si972080ywf.353.2023.10.26.18.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 18:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=FvfKxZTD; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=I6v2OQwJ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id B10AB82CFA69; Thu, 26 Oct 2023 18:56:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229437AbjJ0B43 (ORCPT + 99 others); Thu, 26 Oct 2023 21:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232306AbjJ0B42 (ORCPT ); Thu, 26 Oct 2023 21:56:28 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656F4111 for ; Thu, 26 Oct 2023 18:56:26 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F2A851FEBA; Fri, 27 Oct 2023 01:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698371785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VgRrD8kcNH1PVooSLIMoBgqiyNQdw96No2zl9Hc7W1M=; b=FvfKxZTDKK+rZjkxq4+hCnY+EB7OK4IMQTFDO8ugz5TduV87YZoDjxhhiupMmnUgnVAKuw PpRLnINS5vFWCt950zjUjMmvOIx+QKqg1fnF3vOLDaEPQva2v6C0ug43KtR73ikU7D5QCd I2LTMx4MSI2kTNx3s3ExaGRKKqlFx+c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698371785; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=VgRrD8kcNH1PVooSLIMoBgqiyNQdw96No2zl9Hc7W1M=; b=I6v2OQwJw7u8hyR1AtoPMnfMY1qvbvvGyY8mr5vEZWRjLzkyrBuzF8jbjq54S0gftnzBT+ sT8Ueyr/P01wqhBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E55F3133F5; Fri, 27 Oct 2023 01:56:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 66dyJcYYO2XlCQAAMHmgww (envelope-from ); Fri, 27 Oct 2023 01:56:22 +0000 From: NeilBrown To: Chuck Lever , Jeff Layton Cc: linux-nfs@vger.kernel.org, Olga Kornievskaia , Dai Ngo , Tom Talpey Subject: [PATCH 0/6] support admin-revocation of v4 state Date: Fri, 27 Oct 2023 12:45:28 +1100 Message-ID: <20231027015613.26247-1-neilb@suse.de> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 18:56:30 -0700 (PDT) This is a revised version of a patch set I sent over a year ago. It now supports v4.0 and has had more testing. There are cirsumstances where an admin might need to unmount a filesystem that is NFS-exported and in active use, but does not want to stop the NFS server completely. These are certainly unusual circumstance and doing this might negatively impact any clients acting on the filesystem, but the admin should be able to do this. Currently this is quite possible for for NFSv3. Unexporting the filesystem will ensure no new opens happen, and writing the path name to /proc/fs/nfsd/unlock_filesystem will ensure anly NLM locks held in the filesystem are released so that NFSD no longer prevents the filesystem from being unlocked. It is not currently possible for NFSv4. Writing to unlock_filesystem does not affect NFSv4, which is arguably a bug. This series fixes the bug. For NFSv4.1 and later code is straight forward. We add new state types for admin-revoked state (open, lock, deleg) and change the type of any state on a filesystem - inavlidating any access and closing files as we go. While there are any revoked states we report this to the client in the response to SEQUENCE requests, and it will check and free any states that need to be freed. For NFSv4.0 it isn't quite so easy as there is no mechanism for the client to explicitly acknowledged admin-revoked states. The approach this patchset takes is to discard NFSv4.0 admin-revoked states one lease-time after they were revoked, or immediately for a state that the client tryies to use and gets an "ADMIN_REVOKED" error for. If the filestystem has been unmounted (as expected), the client will see STATE errors before it has a chance to see ADMIN_REVOKED errors, so most often the timeout will be how states are discarded. NeilBrown [PATCH 1/6] nfsd: prepare for supporting admin-revocation of state [PATCH 2/6] nfsd: allow admin-revoked state to appear in [PATCH 3/6] nfsd: allow admin-revoked NFSv4.0 state to be freed. [PATCH 4/6] nfsd: allow lock state ids to be revoked and then freed [PATCH 5/6] nfsd: allow open state ids to be revoked and then freed [PATCH 6/6] nfsd: allow delegation state ids to be revoked and then