Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3137596yba; Mon, 6 May 2019 18:03:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqgVMgOwUNyB0VF1Wn+DRn0XPQMoPRGJGZvaaon7U++FzXDp/l9RIiEqxnRv0+SFDyajdq X-Received: by 2002:a63:6fcf:: with SMTP id k198mr35698094pgc.158.1557190989414; Mon, 06 May 2019 18:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557190989; cv=none; d=google.com; s=arc-20160816; b=OLALnr3q/7aZOVvHyoKW4ahg29xkKHGWyWHnVcQ6t2/dLG53/a3AljJOrWbq6r2dmB u/a/TGLmaCnRPYFN0Q/T9KgDjDtNT8KT1+riRapuOwQ7e7twZ/vcjkhG7l0BFqaIg31y 4BKg57/jPiTvcx2JIhzZ4HS/bhS/bz7hysGkI7ZjJmpc3PhNmvbbv55Zui8XxojnmmGu UfZ4DqpodiM5xWORtdY5naZtfkd3iP5LX1UjRc8HlLdbNDYl/w+cgaxH4AJHN1W+wwlp zz2+iJAxPu8HjY/WJ88hg7Ikou7CcgAcd0AP4OZKSTNVrPzT/MyApdHCp5oI8/O+zUR+ 7Yog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date; bh=qijAVNyhQLXrS/akNq6sJ2CTpU/xJkriUtyR5Af0/mk=; b=Hpu8pNWWgrFKsJ7ctPAfdm/X6UGqVVBgf4HBZRwCYOvYIpOYP/5Wg5l5LSsHLrYI9L cL8wRxEXoo4BO/Nf1B2lSru0bQpJP0C/EIgOiN3ZbkyyYT6cyojWsfJUn+m7fRy81qbt yOS147EtDbZZGtaAlrvn+DoISyb3Orshr4H0ndsrFygX9iL9HA6wE8DlVet3EF5eiYiA CJzt2dFT8jKD3DMmM51KR9Wv6J6NpqCeY+aC9C9XIxY75z2LscaHsHTimsBZ9DGtDcl1 19vBDEyi05RWRsrML/zYRckHrtSVD5VquJaSJ5YkFvsQc2QRsJ3qSPlnVN35FcL1wIYi pXJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si9397820pgc.267.2019.05.06.18.02.45; Mon, 06 May 2019 18:03:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726404AbfEGBCn (ORCPT + 99 others); Mon, 6 May 2019 21:02:43 -0400 Received: from fieldses.org ([173.255.197.46]:58610 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbfEGBCn (ORCPT ); Mon, 6 May 2019 21:02:43 -0400 Received: by fieldses.org (Postfix, from userid 2815) id A6D24C57; Mon, 6 May 2019 21:02:42 -0400 (EDT) Date: Mon, 6 May 2019 21:02:42 -0400 To: Andrew W Elble Cc: Benjamin Coddington , "J. Bruce Fields" , linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, abe@purdue.edu, lsof-l@lists.purdue.edu, util-linux@vger.kernel.org, jlayton@redhat.com Subject: Re: [PATCH 09/10] nfsd: expose some more information about NFSv4 opens Message-ID: <20190507010242.GB4835@fieldses.org> References: <1556201060-7947-1-git-send-email-bfields@redhat.com> <1556201060-7947-10-git-send-email-bfields@redhat.com> <786E0C83-A22D-461A-A9D1-AF7B42018CE9@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, May 02, 2019 at 11:58:06AM -0400, Andrew W Elble wrote: > Benjamin Coddington writes: > > > On 25 Apr 2019, at 10:04, J. Bruce Fields wrote: > > > >> From: "J. Bruce Fields" > >> > >> Add open modes, device numbers, inode numbers, and open owners to each > >> line of nfsd/clients/#/opens. > >> > >> Open owners are totally opaque but seem to sometimes have some useful > >> ascii strings included, so passing through printable ascii characters > >> and escaping the rest seems useful while still being machine-readable. > >> --- > >> fs/nfsd/nfs4state.c | 40 > >> ++++++++++++++++++++++++++++------ > >> fs/nfsd/state.h | 2 +- > >> fs/seq_file.c | 17 +++++++++++++++ > >> include/linux/seq_file.h | 2 ++ > >> include/linux/string_helpers.h | 1 + > >> lib/string_helpers.c | 5 +++-- > >> 6 files changed, 57 insertions(+), 10 deletions(-) > >> > >> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > >> index 829d1e5440d3..f53621a65e60 100644 > >> --- a/fs/nfsd/nfs4state.c > >> +++ b/fs/nfsd/nfs4state.c > >> @@ -42,6 +42,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> #include "xdr4.h" > >> #include "xdr4cb.h" > >> #include "vfs.h" > >> @@ -2261,16 +2262,41 @@ static void opens_stop(struct seq_file *s, > >> void *v) > >> static int opens_show(struct seq_file *s, void *v) > >> { > >> struct nfs4_stid *st = v; > >> - struct nfs4_ol_stateid *os; > >> - u64 stateid; > >> + struct nfs4_ol_stateid *ols; > >> + struct nfs4_file *nf; > >> + struct file *file; > >> + struct inode *inode; > >> + struct nfs4_stateowner *oo; > >> + unsigned int access, deny; > >> > >> if (st->sc_type != NFS4_OPEN_STID) > >> return 0; /* XXX: or SEQ_SKIP? */ > >> - os = openlockstateid(st); > >> - /* XXX: get info about file, etc., here */ > >> + ols = openlockstateid(st); > >> + oo = ols->st_stateowner; > >> + nf = st->sc_file; > >> + file = find_any_file(nf); > > Is there a matching fput() missing somewhere, or did I just not see it...? Oops, fixed. > >> + inode = d_inode(file->f_path.dentry); > >> + > >> + seq_printf(s, STATEID_FMT, STATEID_VAL(&st->sc_stateid)); > > > > Should we match the byte order printed with what wireshark/tshark sees? > > ^^ +1 Yeah, I agree, I'm changing that to just be a "%16phN", which should give us what wireshark does. Thanks for the review! --b.