Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp1880728rdb; Sun, 19 Nov 2023 14:46:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLIvDk2CLTjNPDEwf/u35W+XYplnq1bjUHVBYoZ2toGrFSQforpYpQ5YGgmgGkNh2QZIFV X-Received: by 2002:a17:902:d4d1:b0:1cf:59d5:2db1 with SMTP id o17-20020a170902d4d100b001cf59d52db1mr3843931plg.10.1700433962707; Sun, 19 Nov 2023 14:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700433962; cv=none; d=google.com; s=arc-20160816; b=bagEIaWyAqvqpHR7tR+z0ikhOc5YBvCRhIRsGPyuDMyCfDSPyPk+Co9wHIpV8Z69y6 R5TEnkLinJGqSrjp9wcXSDamZZ5GtCfwsWoPzslLfMxktL1WIVGBbxe6t/dUoM+v5vFh 11Dl/rVHWFJcFrXRCCQOy04YQ+uF50uBjHRg5x5CivN6y8VLCslt88dLYJTUdNb80BWa zSL0znVmbJHnhhCn29IXdpOX71XixyZXU8qEGdJMX9/rn5CKHzuut+7248PruA8DEMy8 +IZ3/hXKQB7iHIyeFGAlkCy7iS8zj7kiPviG/WROAgo/9YcgY1yhYcNEwG32y4lr6K5k p48w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=CoLhogCbUPbV3QR7cDgeU6EMhEutQ6Q1A7Q6TV3FlQY=; fh=HmrqYq5qjk3xA6tidfv4QO0+vHztazMqOteBU1qSCrc=; b=MamVuwKeQnBGBjK3Kz82s8Sz2Pxi1SE/I8UdUeSl8Yu3eOEoeqvR/TH0Q6m7DbY+nE 2rP8E2mSyck888ocXrpxo0RnnPZWpp+Gmz1ZBemwJO+ErK2ZxRL5EeIXWxnxAGWSmzkn x91rObAHh18dGAT/qzBWtQ8r36qrBlFQMWBdezh90Xafy+PXfDyBIDOrf4xcImyIAPAx wW844VPiVy665Sxhf/73bifAEzT+VI2zqlCFDNBBp71ji3Y9+iaZhdLgtJhB6r4S1xeN SLY4lIlTkMcKPtmVCWRsGfI3U63QkfCTRIEogQji1ZbF/YRJS89plrzP4iu84vF0EAgu zfgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=BZtg6ap+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=0I1B3czf; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n2-20020a170902d2c200b001b9e9edea43si7209478plc.552.2023.11.19.14.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 14:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=BZtg6ap+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=0I1B3czf; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 2D19D80A30E8; Sun, 19 Nov 2023 14:46:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231534AbjKSWg4 (ORCPT + 99 others); Sun, 19 Nov 2023 17:36:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbjKSWg4 (ORCPT ); Sun, 19 Nov 2023 17:36:56 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 827FA137 for ; Sun, 19 Nov 2023 14:36:52 -0800 (PST) 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-out1.suse.de (Postfix) with ESMTPS id 20449218EA; Sun, 19 Nov 2023 22:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1700433411; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CoLhogCbUPbV3QR7cDgeU6EMhEutQ6Q1A7Q6TV3FlQY=; b=BZtg6ap+5BPIpgTX/27LkKyB/kjGE76bx+bgdOh9VaDgHfVd1kLigGUDrE51xD2oXiZgR4 ZBfV8Gm78cIwWvqoXzBZXpMAlkGioVzgI1EDozqplCtkGEkqC9X3rVkiogDf9BzirWdNw+ tIUYMOTN1+rFOW0HHtPFimEyj6PzvcQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1700433411; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CoLhogCbUPbV3QR7cDgeU6EMhEutQ6Q1A7Q6TV3FlQY=; b=0I1B3czfwyQAfY9sjKOVJQhcWEYMFfaRURKpRgAyNxfOSWc+MEyrcYJuvGwxkR+tbOPNd3 z5kP5nXwj2qolDBQ== 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 DBFC7139B7; Sun, 19 Nov 2023 22:36:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id T/tGIwCOWmXWXwAAMHmgww (envelope-from ); Sun, 19 Nov 2023 22:36:48 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: "Chuck Lever" , linux-nfs@vger.kernel.org, "Olga Kornievskaia" , "Dai Ngo" , "Tom Talpey" Subject: Re: [PATCH 5/9] nfsd: allow admin-revoked state to appear in /proc/fs/nfsd/clients/*/states In-reply-to: References: <20231117022121.23310-1-neilb@suse.de>, <20231117022121.23310-6-neilb@suse.de>, Date: Mon, 20 Nov 2023 09:36:45 +1100 Message-id: <170043340577.19300.13599388686680253695@noble.neil.brown.name> Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: 3.40 X-Spamd-Result: default: False [3.40 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(3.00)[0.999]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_FIVE(0.00)[6]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_SPAM_LONG(3.50)[1.000]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sun, 19 Nov 2023 14:46:01 -0800 (PST) On Fri, 17 Nov 2023, Jeff Layton wrote: > On Fri, 2023-11-17 at 13:18 +1100, NeilBrown wrote: > > Change the "show" functions to show some content even if a file cannot > > be found. > > This is primarily useful for debugging - to ensure states are being > > removed eventually. > >=20 > > Signed-off-by: NeilBrown > > --- > > fs/nfsd/nfs4state.c | 81 +++++++++++++++++++++++---------------------- > > 1 file changed, 41 insertions(+), 40 deletions(-) > >=20 > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > index a2b3320a6ba8..8debd148840f 100644 > > --- a/fs/nfsd/nfs4state.c > > +++ b/fs/nfsd/nfs4state.c > > @@ -2680,17 +2680,10 @@ static int nfs4_show_open(struct seq_file *s, str= uct nfs4_stid *st) > > struct nfs4_stateowner *oo; > > unsigned int access, deny; > > =20 > > - if (st->sc_type !=3D NFS4_OPEN_STID && st->sc_type !=3D NFS4_LOCK_STID) > > - return 0; /* XXX: or SEQ_SKIP? */ > > ols =3D openlockstateid(st); > > oo =3D ols->st_stateowner; > > nf =3D st->sc_file; > > =20 > > - spin_lock(&nf->fi_lock); > > - file =3D find_any_file_locked(nf); > > - if (!file) > > - goto out; > > - > > seq_printf(s, "- "); > > nfs4_show_stateid(s, &st->sc_stateid); > > seq_printf(s, ": { type: open, "); > > @@ -2705,14 +2698,19 @@ static int nfs4_show_open(struct seq_file *s, str= uct nfs4_stid *st) > > deny & NFS4_SHARE_ACCESS_READ ? "r" : "-", > > deny & NFS4_SHARE_ACCESS_WRITE ? "w" : "-"); > > =20 > > - nfs4_show_superblock(s, file); > > - seq_printf(s, ", "); > > - nfs4_show_fname(s, file); > > - seq_printf(s, ", "); > > + spin_lock(&nf->fi_lock); > > + file =3D find_any_file_locked(nf); > > + if (file) { > > + nfs4_show_superblock(s, file); > > + seq_puts(s, ", "); > > + nfs4_show_fname(s, file); > > + seq_puts(s, ", "); > > + } > > + spin_unlock(&nf->fi_lock); > > nfs4_show_owner(s, oo); > > + if (st->sc_status & NFS4_STID_ADMIN_REVOKED) > > + seq_puts(s, ", admin-revoked"); > > seq_printf(s, " }\n"); > > -out: > > - spin_unlock(&nf->fi_lock); > > return 0; > > } > > =20 > > @@ -2726,30 +2724,31 @@ static int nfs4_show_lock(struct seq_file *s, str= uct nfs4_stid *st) > > ols =3D openlockstateid(st); > > oo =3D ols->st_stateowner; > > nf =3D st->sc_file; > > - spin_lock(&nf->fi_lock); > > - file =3D find_any_file_locked(nf); > > - if (!file) > > - goto out; > > =20 > > seq_printf(s, "- "); > > nfs4_show_stateid(s, &st->sc_stateid); > > seq_printf(s, ": { type: lock, "); > > =20 > > - /* > > - * Note: a lock stateid isn't really the same thing as a lock, > > - * it's the locking state held by one owner on a file, and there > > - * may be multiple (or no) lock ranges associated with it. > > - * (Same for the matter is true of open stateids.) > > - */ > > + spin_lock(&nf->fi_lock); > > + file =3D find_any_file_locked(nf); > > + if (file) { > > + /* > > + * Note: a lock stateid isn't really the same thing as a lock, > > + * it's the locking state held by one owner on a file, and there > > + * may be multiple (or no) lock ranges associated with it. > > + * (Same for the matter is true of open stateids.) > > + */ > > =20 > > - nfs4_show_superblock(s, file); > > - /* XXX: open stateid? */ > > - seq_printf(s, ", "); > > - nfs4_show_fname(s, file); > > - seq_printf(s, ", "); > > + nfs4_show_superblock(s, file); > > + /* XXX: open stateid? */ > > + seq_puts(s, ", "); > > + nfs4_show_fname(s, file); > > + seq_puts(s, ", "); > > + } > > nfs4_show_owner(s, oo); > > + if (st->sc_status & NFS4_STID_ADMIN_REVOKED) > > + seq_puts(s, ", admin-revoked"); > > seq_printf(s, " }\n"); > > -out: > > spin_unlock(&nf->fi_lock); > > return 0; > > } > > @@ -2762,27 +2761,29 @@ static int nfs4_show_deleg(struct seq_file *s, st= ruct nfs4_stid *st) > > =20 > > ds =3D delegstateid(st); > > nf =3D st->sc_file; > > - spin_lock(&nf->fi_lock); > > - file =3D nf->fi_deleg_file; > > - if (!file) > > - goto out; > > =20 > > seq_printf(s, "- "); > > nfs4_show_stateid(s, &st->sc_stateid); > > seq_printf(s, ": { type: deleg, "); > > =20 > > /* Kinda dead code as long as we only support read delegs: */ >=20 > nit: You can probably remove the above comment since we now support > write delegations. Done. Thanks for the suggestion. NeilBrown >=20 > > - seq_printf(s, "access: %s, ", > > - ds->dl_type =3D=3D NFS4_OPEN_DELEGATE_READ ? "r" : "w"); > > + seq_printf(s, "access: %s", > > + ds->dl_type =3D=3D NFS4_OPEN_DELEGATE_READ ? "r" : "w"); > > =20 > > /* XXX: lease time, whether it's being recalled. */ > > =20 > > - nfs4_show_superblock(s, file); > > - seq_printf(s, ", "); > > - nfs4_show_fname(s, file); > > - seq_printf(s, " }\n"); > > -out: > > + spin_lock(&nf->fi_lock); > > + file =3D nf->fi_deleg_file; > > + if (file) { > > + seq_puts(s, ", "); > > + nfs4_show_superblock(s, file); > > + seq_puts(s, ", "); > > + nfs4_show_fname(s, file); > > + } > > spin_unlock(&nf->fi_lock); > > + if (st->sc_status & NFS4_STID_ADMIN_REVOKED) > > + seq_puts(s, ", admin-revoked"); > > + seq_puts(s, " }\n"); > > return 0; > > } > > =20 >=20 > --=20 > Jeff Layton >=20