All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: "J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 00/16] exposing knfsd client state to userspace
Date: Thu, 20 Jun 2019 10:50:59 -0400	[thread overview]
Message-ID: <1561042275-12723-1-git-send-email-bfields@redhat.com> (raw)

From: "J. Bruce Fields" <bfields@redhat.com>

Changes since last time:
	- added display of client implementation ID
	- changed display of binary data to escape anything nonprintable
	  or nonascii
	- some minor cleanup and patch reshuffling

I'm happy enough with at this point and hoping to merge it for 5.3.

Recapping discussion from last time:

The following patches expose information about NFSv4 state held by knfsd
on behalf of NFSv4 clients.  This is especially important for opens,
which are currently invisible to userspace on the server, unlike locks
(/proc/locks) and local processes' opens (under /proc/<pid>/).

The approach is to add a new directory /proc/fs/nfsd/clients/ with
subdirectories for each active NFSv4 client.  Each subdirectory has an
"info" file with some basic information to help identify the client and
a "states" directory that lists the open state held by that client.

Currently these pseudofiles look like:

# find /proc/fs/nfsd/clients -type f|xargs tail
==> /proc/fs/nfsd/clients/3/ctl <==
tail: error reading '/proc/fs/nfsd/clients/3/ctl': Invalid argument

==> /proc/fs/nfsd/clients/3/states <==
- 0x01000000f58f0b5d2898a19801000000: { type: open, access: r-, deny: --, superblock: "fd:10:13649", owner: "open id:\x00\x00\x00&\x00\x00\x00\x00\x00\x00\x02x\xac\xd0 \x09" }
- 0x01000000f58f0b5d2898a19802000000: { type: deleg, access: r, superblock: "fd:10:13649" }
- 0x01000000f58f0b5d2898a19803000000: { type: open, access: r-, deny: --, superblock: "fd:10:13650", owner: "open id:\x00\x00\x00&\x00\x00\x00\x00\x00\x00\x02x\xac\xd0 \x09" }
- 0x01000000f58f0b5d2898a19804000000: { type: deleg, access: r, superblock: "fd:10:13650" }

==> /proc/fs/nfsd/clients/3/info <==
clientid: 0x98a198285d0b8ff5
address: "192.168.122.36:935"
name: "Linux NFSv4.2 test2.fieldses.org"
minor version: 2
Implementation domain: "kernel.org"
Implementation name: "Linux 5.2.0-rc1-00017-ge73cab140ec0 #2263 SMP PREEMPT Tue Jun 18 16:54:41 EDT 2019 x86_64"
Implementation time: [0, 0]

The "ctl" file is not readable; all you can do is write "expire\n" to it
to force the server to revoke all that client's state.

The "info" and "states" files are meant to be valid YAML.

Possibly also todo, though I think none have to be done before merging:
	- add some information about krb5 principals to the clients
	  file.
	- add information about the stateids used to represent
	  asynchronous copies.  They're a little different from the
	  other stateids and might end up in a separate "copies" file,
	- this duplicates some functionality of the little-used fault
	  injection code; could we replace it entirely?
	- some of the bits of filesystem code could probably be shared
	  with rpc_pipefs and libfs.

--b.

J. Bruce Fields (16):
  nfsd: persist nfsd filesystem across mounts
  nfsd: rename cl_refcount
  nfsd4: use reference count to free client
  nfsd: add nfsd/clients directory
  nfsd: make client/ directory names small ints
  nfsd4: add a client info file
  nfsd: copy client's address including port number to cl_addr
  nfsd: escape high characters in binary data
  nfsd: add more information to client info file
  nfsd4: add file to display list of client's opens
  nfsd: show lock and deleg stateids
  nfsd4: show layout stateids
  nfsd: create get_nfsdfs_clp helper
  nfsd: allow forced expiration of NFSv4 clients
  nfsd: create xdr_netobj_dup helper
  nfsd: decode implementation id

 fs/nfsd/netns.h                |   6 +
 fs/nfsd/nfs4state.c            | 453 ++++++++++++++++++++++++++++++---
 fs/nfsd/nfs4xdr.c              |  21 +-
 fs/nfsd/nfsctl.c               | 221 +++++++++++++++-
 fs/nfsd/nfsd.h                 |  11 +
 fs/nfsd/state.h                |  11 +-
 fs/nfsd/xdr4.h                 |   3 +
 fs/seq_file.c                  |  11 +
 include/linux/seq_file.h       |   1 +
 include/linux/string_helpers.h |   3 +
 include/linux/sunrpc/xdr.h     |   7 +
 lib/string_helpers.c           |  19 ++
 12 files changed, 723 insertions(+), 44 deletions(-)

-- 
2.21.0


             reply	other threads:[~2019-06-20 14:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 14:50 J. Bruce Fields [this message]
2019-06-20 14:51 ` [PATCH 01/16] nfsd: persist nfsd filesystem across mounts J. Bruce Fields
2019-06-20 14:51 ` [PATCH 02/16] nfsd: rename cl_refcount J. Bruce Fields
2019-06-20 14:51 ` [PATCH 03/16] nfsd4: use reference count to free client J. Bruce Fields
2019-06-20 14:51 ` [PATCH 04/16] nfsd: add nfsd/clients directory J. Bruce Fields
2019-06-20 14:51 ` [PATCH 05/16] nfsd: make client/ directory names small ints J. Bruce Fields
2019-06-20 14:51 ` [PATCH 06/16] nfsd4: add a client info file J. Bruce Fields
2019-06-20 14:51 ` [PATCH 07/16] nfsd: copy client's address including port number to cl_addr J. Bruce Fields
2019-06-20 14:51 ` [PATCH 08/16] nfsd: escape high characters in binary data J. Bruce Fields
2019-06-21 17:45   ` J. Bruce Fields
2019-06-21 22:26     ` Kees Cook
2019-06-22 19:00       ` J. Bruce Fields
2019-06-22 20:22         ` Kees Cook
2019-06-24 21:05           ` J. Bruce Fields
2019-06-26 16:21             ` J. Bruce Fields
2019-06-27  4:16               ` Kees Cook
2019-06-27 15:23                 ` J. Bruce Fields
2019-06-27 20:21               ` J. Bruce Fields
2019-06-28  3:58                 ` Kees Cook
2019-06-28 16:33                   ` J. Bruce Fields
2019-07-10 22:09                     ` J. Bruce Fields
2019-07-11  1:54                       ` Kees Cook
2019-08-06 12:19   ` Andy Shevchenko
2019-08-06 18:50     ` J. Bruce Fields
2019-08-07  9:00       ` Andy Shevchenko
2019-08-08 11:28         ` J. Bruce Fields
2019-08-27 13:36           ` Andy Shevchenko
2019-06-20 14:51 ` [PATCH 09/16] nfsd: add more information to client info file J. Bruce Fields
2019-06-20 14:51 ` [PATCH 10/16] nfsd4: add file to display list of client's opens J. Bruce Fields
2019-06-20 14:51 ` [PATCH 11/16] nfsd: show lock and deleg stateids J. Bruce Fields
2019-06-20 14:51 ` [PATCH 12/16] nfsd4: show layout stateids J. Bruce Fields
2019-06-20 14:51 ` [PATCH 13/16] nfsd: create get_nfsdfs_clp helper J. Bruce Fields
2019-06-20 14:51 ` [PATCH 14/16] nfsd: allow forced expiration of NFSv4 clients J. Bruce Fields
2019-06-20 14:51 ` [PATCH 15/16] nfsd: create xdr_netobj_dup helper J. Bruce Fields
2019-06-20 14:51 ` [PATCH 16/16] nfsd: decode implementation id J. Bruce Fields
2019-06-21 18:13 ` [PATCH 00/16] exposing knfsd client state to userspace J. Bruce Fields
2019-06-21 19:25   ` Anna Schumaker
2019-06-21 22:08     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561042275-12723-1-git-send-email-bfields@redhat.com \
    --to=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.