Its been awhile, so here's a version 4 of the NFS sysfs scaffolding. This version is similar to v3, but is network namespace aware. Shutdown works well to clean up serverless clients, unless there are pNFS DS clients. A future version (in the works) will support shutdown for DS clients as well. The client identifier path (unchanged here) is a little awkward - I don't think the "net" and "nfs_client" directories add anything useful, but they were artifacts of working with the sysfs namespace API. I don't think we can change it now without risking silent breakage. We get around needing extra directories here by open-coding kset_create_and_add() in patch 3. I have Anna's optional server feature control namespaced and working well, but I've left it out for now because I'd like to split it into individual attribute files once I saw how easy it was to map the features into sysfs attributes. This seems to better fit the sysfs' style of one file-per-attribute. However, after getting things to work with namespaces I found that the sysfs macros to do this are not namespace aware, and much of the work would need either lots of open coding or our own set of macros to reduce redudant lines of code. Changes since version 3: https://lore.kernel.org/linux-nfs/cover.1682097420.git.bcodding@xxxxxxxxxx/ - /sys/fs/nfs/* objects are network-namespace unique Benjamin Coddington (11): NFS: rename nfs_client_kset to nfs_kset NFS: rename nfs_client_kobj to nfs_net_kobj NFS: Open-code the nfs_kset kset_create_and_add() NFS: Make all of /sys/fs/nfs network-namespace unique NFS: add superblock sysfs entries NFS: Add sysfs links to sunrpc clients for nfs_clients NFS: add a sysfs link to the lockd rpc_client NFS: add a sysfs link to the acl rpc_client NFS: add sysfs shutdown knob NFS: Cancel all existing RPC tasks when shutdown NFSv4: Clean up some shutdown loops fs/lockd/clntlock.c | 6 + fs/nfs/client.c | 22 ++++ fs/nfs/nfs3client.c | 4 + fs/nfs/nfs4client.c | 4 + fs/nfs/nfs4proc.c | 2 +- fs/nfs/nfs4state.c | 3 + fs/nfs/super.c | 6 +- fs/nfs/sysfs.c | 235 ++++++++++++++++++++++++++++++------ fs/nfs/sysfs.h | 10 +- include/linux/lockd/bind.h | 2 + include/linux/nfs_fs_sb.h | 3 + include/linux/sunrpc/clnt.h | 11 +- net/sunrpc/clnt.c | 5 + net/sunrpc/sysfs.h | 7 -- 14 files changed, 274 insertions(+), 46 deletions(-) -- 2.40.1