[PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records

David Howells posted 15 patches 11 months, 2 weeks ago
There is a newer version of this series
fs/afs/addr_list.c         |  50 +++
fs/afs/cell.c              | 436 +++++++++++----------------
fs/afs/cmservice.c         |  82 +----
fs/afs/dir.c               |   5 +-
fs/afs/dynroot.c           | 484 ++++++++++++-----------------
fs/afs/fs_probe.c          |  32 +-
fs/afs/fsclient.c          |   4 +-
fs/afs/internal.h          |  98 +++---
fs/afs/main.c              |  16 +-
fs/afs/mntpt.c             |   5 +-
fs/afs/proc.c              |  15 +-
fs/afs/rxrpc.c             |   8 +-
fs/afs/server.c            | 602 ++++++++++++++++---------------------
fs/afs/server_list.c       |   6 +-
fs/afs/super.c             |  25 +-
fs/afs/vl_alias.c          |   7 +-
fs/afs/vl_rotate.c         |   2 +-
fs/afs/volume.c            |  15 +-
include/net/af_rxrpc.h     |   2 +
include/trace/events/afs.h |  85 +++---
net/rxrpc/ar-internal.h    |   2 +-
net/rxrpc/input.c          |   2 -
net/rxrpc/peer_event.c     |   9 +-
net/rxrpc/peer_object.c    |  35 ++-
net/rxrpc/rxperf.c         |  12 +
25 files changed, 922 insertions(+), 1117 deletions(-)
[PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records
Posted by David Howells 11 months, 2 weeks ago
Here are some patches that fix an occasional hang that's only really
encountered when rmmod'ing the kafs module.  Arguably, this could also go
through the vfs tree, but I have a bunch more primarily crypto and rxrpc
patches that need to go through net-next on top of this[1].

Now, at the beginning of this set, I've included five fix patches that are
already committed to the net/main branch but that need to be applied first,
but haven't made their way into net-next/main or upstream as yet:

    rxrpc: rxperf: Fix missing decoding of terminal magic cookie
    rxrpc: peer->mtu_lock is redundant
    rxrpc: Fix locking issues with the peer record hash
    afs: Fix the server_list to unuse a displaced server rather than putting it
    afs: Give an afs_server object a ref on the afs_cell object it points to

On top of those, I have:

 (1) Remove the "-o autocell" mount option.  This is obsolete with the
     dynamic root and removing it makes the next patch slightly easier.

 (2) Change how the dynamic root mount is constructed.  Currently, the root
     directory is (de)populated when it is (un)mounted if there are cells
     already configured and, further, pairs of automount points have to be
     created/removed each time a cell is added/deleted.

     This is changed so that readdir on the root dir lists all the known
     cell automount pairs plus the @cell symlinks and the inodes and
     dentries are constructed by lookup on demand.  This simplifies the
     cell management code.

 (3) A few improvements to the afs_volume tracepoint.

 (4) A few improvements to the afs_server tracepoint.

 (5) Pass trace info into the afs_lookup_cell() function to allow the trace
     log to indicate the purpose of the lookup.

 (6) Remove the 'net' parameter from afs_unuse_cell() as it's superfluous.

 (7) In rxrpc, allow a kernel app (such as kafs) to store a word of
     information on rxrpc_peer records.

 (8) Use the information stored on the rxrpc_peer record to point to the
     afs_server record.  This allows the server address lookup to be done
     away with.

 (9) Simplify the afs_server ref/activity accounting to make each one
     self-contained and not garbage collected from the cell management work
     item.

(10) Simplify the afs_cell ref/activity accounting to make each one of
     these also self-contained and not driven by a central management work
     item.

     The current code was intended to make it such that a single timer for
     the namespace and one work item per cell could do all the work
     required to maintain these records.  This, however, made for some
     sequencing problems when cleaning up these records.  Further, the
     attempt to pass refs along with timers and work items made getting it
     right rather tricky when the timer or work item already had a ref
     attached and now a ref had to be got rid of.

David

The patches can be found on this branch also:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-next

Link: http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=crypto-krb5 [1]

David Howells (15):
  rxrpc: rxperf: Fix missing decoding of terminal magic cookie
  rxrpc: peer->mtu_lock is redundant
  rxrpc: Fix locking issues with the peer record hash
  afs: Fix the server_list to unuse a displaced server rather than
    putting it
  afs: Give an afs_server object a ref on the afs_cell object it points
    to
  afs: Remove the "autocell" mount option
  afs: Change dynroot to create contents on demand
  afs: Improve afs_volume tracing to display a debug ID
  afs: Improve server refcount/active count tracing
  afs: Make afs_lookup_cell() take a trace note
  afs: Drop the net parameter from afs_unuse_cell()
  rxrpc: Allow the app to store private data on peer structs
  afs: Use the per-peer app data provided by rxrpc
  afs: Fix afs_server ref accounting
  afs: Simplify cell record handling

 fs/afs/addr_list.c         |  50 +++
 fs/afs/cell.c              | 436 +++++++++++----------------
 fs/afs/cmservice.c         |  82 +----
 fs/afs/dir.c               |   5 +-
 fs/afs/dynroot.c           | 484 ++++++++++++-----------------
 fs/afs/fs_probe.c          |  32 +-
 fs/afs/fsclient.c          |   4 +-
 fs/afs/internal.h          |  98 +++---
 fs/afs/main.c              |  16 +-
 fs/afs/mntpt.c             |   5 +-
 fs/afs/proc.c              |  15 +-
 fs/afs/rxrpc.c             |   8 +-
 fs/afs/server.c            | 602 ++++++++++++++++---------------------
 fs/afs/server_list.c       |   6 +-
 fs/afs/super.c             |  25 +-
 fs/afs/vl_alias.c          |   7 +-
 fs/afs/vl_rotate.c         |   2 +-
 fs/afs/volume.c            |  15 +-
 include/net/af_rxrpc.h     |   2 +
 include/trace/events/afs.h |  85 +++---
 net/rxrpc/ar-internal.h    |   2 +-
 net/rxrpc/input.c          |   2 -
 net/rxrpc/peer_event.c     |   9 +-
 net/rxrpc/peer_object.c    |  35 ++-
 net/rxrpc/rxperf.c         |  12 +
 25 files changed, 922 insertions(+), 1117 deletions(-)
Re: [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records
Posted by Paolo Abeni 11 months, 2 weeks ago
On 2/25/25 12:41 AM, David Howells wrote:
> Here are some patches that fix an occasional hang that's only really
> encountered when rmmod'ing the kafs module.  Arguably, this could also go
> through the vfs tree, but I have a bunch more primarily crypto and rxrpc
> patches that need to go through net-next on top of this[1].
> 
> Now, at the beginning of this set, I've included five fix patches that are
> already committed to the net/main branch but that need to be applied first,
> but haven't made their way into net-next/main or upstream as yet:
> 
>     rxrpc: rxperf: Fix missing decoding of terminal magic cookie
>     rxrpc: peer->mtu_lock is redundant
>     rxrpc: Fix locking issues with the peer record hash
>     afs: Fix the server_list to unuse a displaced server rather than putting it
>     afs: Give an afs_server object a ref on the afs_cell object it points to

You don't need to re-post such patches, just wait a couple of days, when
net will be merged back into net-next. So that we will not have
"duplicate changes" inside the tree.

The remaining patches in this series touch only AFS, I'm unsure if
net-next if the best target here??? The rxrpc follow-up could just wait
the upcoming net -> net-next merge. AFAICS crypto patches go trough
their own tree.

Thanks!

Paolo
Re: [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records
Posted by David Howells 11 months, 2 weeks ago
Paolo Abeni <pabeni@redhat.com> wrote:

> The remaining patches in this series touch only AFS, I'm unsure if net-next
> if the best target here???

Yeah.  It's tricky as the complete set of patches I would like to post spans
three subsystems.

> The rxrpc follow-up could just wait the upcoming net -> net-next merge.
> AFAICS crypto patches go trough their own tree.

Ah, no.  That doesn't work.  The rxrpc follow-up needs the crypto patches to
even compile and so needs to go through the same tree.

Further, the afs patches in this patchset are also something of a
pre-requisite for the afs part of the rxrpc follow-up.  The problem is that we
have to be able to map back from the address in a challenge packet back to the
managing socket and the server record in order that we can send find the info
to put in the response packet and the key required in order to encrypt it.

This is something that this patchset deals with, as part of fixing some a
couple of very low-probability bugs (hence why I proposed it for net-next
rather than pushing it Linuswards).

If you prefer, I can see about sending all the patches through the vfs tree or
the crypto tree rather than net-next.  Or I can see if I can push this set as
a bug fix through the VFS tree.

David
Re: [PATCH net-next 00/15] afs, rxrpc: Clean up refcounting on afs_cell and afs_server records
Posted by Paolo Abeni 11 months, 2 weeks ago
On 2/27/25 2:10 PM, David Howells wrote:
> Paolo Abeni <pabeni@redhat.com> wrote:
>> The remaining patches in this series touch only AFS, I'm unsure if net-next
>> if the best target here???
> 
> Yeah.  It's tricky as the complete set of patches I would like to post spans
> three subsystems.

Possibly sharing a stable tree somewhere, and let the relevant subsystem
pull the tree specific deps/bits could help?

/P
Which tree to push afs + crypto + rxrpc spanning patches through?
Posted by David Howells 11 months, 2 weeks ago
Paolo Abeni <pabeni@redhat.com> wrote:

> >> The remaining patches in this series touch only AFS, I'm unsure if net-next
> >> if the best target here???
> > 
> > Yeah.  It's tricky as the complete set of patches I would like to post spans
> > three subsystems.
> 
> Possibly sharing a stable tree somewhere, and let the relevant subsystem
> pull the tree specific deps/bits could help?

The networking tree would still have to take the afs and crypto bits in order
to take the rxrpc bits so that the code compiles.  Unfortunately, the rxrpc
bits depend on the other two.

If you're okay with the rxrpc bits not going through the networking tree and
if Herbert is okay with the krb5 library not going through the crypto tree, I
can try pushing the whole lot through the filesystem tree.

David
Re: Which tree to push afs + crypto + rxrpc spanning patches through?
Posted by Herbert Xu 11 months, 2 weeks ago
On Thu, Feb 27, 2025 at 03:36:31PM +0000, David Howells wrote:
>
> If you're okay with the rxrpc bits not going through the networking tree and
> if Herbert is okay with the krb5 library not going through the crypto tree, I
> can try pushing the whole lot through the filesystem tree.

Sure I have no objections.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt