Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2020779ybi; Thu, 20 Jun 2019 07:52:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyJNkAIqGQQT5Zmv0NfyHPxDc6XNujpYZRDJxqyYyyrJ12jALEUCohpLO8t69C8Ek+mCrW X-Received: by 2002:a63:5c19:: with SMTP id q25mr13466113pgb.215.1561042327019; Thu, 20 Jun 2019 07:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561042327; cv=none; d=google.com; s=arc-20160816; b=Y26YUi/Ow1X3wY3PqnPhCJgDP60Kz7PnQpqFT9uJUXeO+uPf/jzCW/vR78vH3acgix yOt0z4Dn652DvMS0t/i4XWtlakw5RjXM/Gz6N+/JHpantAYVPdHc37SQQT7IRL+3Lg1p uFRNhAJarkYKz9sVpNRtKp6rfQOxL3wYpY9YfJtL8ovJgdLQYUaFUyQChk63fkqbkofc aGRJO8JQ7jn1ANqjQS7MSN/ksAFLqVivS5Vu7kLr+aGyRYXzUMO7jDZVdxFXzGh19/tS Q1H78+v1WeTnD+dXCW0kq9jCanqmRyGx8dFhNy3Rqdkkc3vJrl4OFxrxgJIykRkBokMg 0Dzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=E8ENzyHcavrhisv4HsVz0h418CaNTkGAZ5fdHxZCbIY=; b=fCbrMWAaqZZ2uKCowuVBIQR7ZvLvHfkhNfQ5Jhbe9NTxOqlSafHcyPA/F367llAjUx j9vYacYdKptUgSMEeNCJbJieK/Y1ExW1xpl3rBkf6OdWE/WGYyIW8JQOVcci+qc0vyN2 tFceK/k+QUEjJLtRBOw1DJfI2QNCvZqodQhmH8iv+3NMWVHMYHeCIFLzBPljnCkAa1BK dDVEqNuQe0yvhLZJ+ZUC+PuuEWjc6LOYgS1o0w+/jk/LQdO1DhOgjCikwSyU60lNaYtr eGm9gPWByR35JeuqcFBBc3ENoW96qzVE+eKKUSUYLTknVjoRjvkgIvs5cx67ZZDyFzHC M1zQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si17660833plo.308.2019.06.20.07.51.52; Thu, 20 Jun 2019 07:52:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726796AbfFTOv1 (ORCPT + 99 others); Thu, 20 Jun 2019 10:51:27 -0400 Received: from fieldses.org ([173.255.197.46]:43432 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726654AbfFTOvV (ORCPT ); Thu, 20 Jun 2019 10:51:21 -0400 Received: by fieldses.org (Postfix, from userid 2815) id E37291E19; Thu, 20 Jun 2019 10:51:20 -0400 (EDT) From: "J. Bruce Fields" To: linux-nfs@vger.kernel.org Cc: "J. Bruce Fields" Subject: [PATCH 00/16] exposing knfsd client state to userspace Date: Thu, 20 Jun 2019 10:50:59 -0400 Message-Id: <1561042275-12723-1-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: "J. Bruce Fields" 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//). 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