Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@poochiereds.net>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Subject: usage of inotify in nfs-utils
Date: Thu, 16 May 2024 07:17:08 -0600	[thread overview]
Message-ID: <a40089cd2c7d492859dec6a7ef134d8f68aa761d.camel@poochiereds.net> (raw)

Al was asking about inotify usage in the rpc_pipefs dir.  If you want
to check further, all the binaries that operate under there are in
nfs-utils:

     http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=summary

I took a quick look, and cscope shows these watches being added (with a
little annotation):

mountd and exportd watch creates and deletes in the nfsdfs clients dir:

    0 support/export/v4clients.c        40 if (inotify_add_watch(clients_fd, "/proc/fs/nfsd/clients", IN_CREATE | IN_DELETE) < 0) {

...if one of those directories is created, it watches for modifications
to the "info" file in there:

    1 support/export/v4clients.c	   117 key->wid = inotify_add_watch(clients_fd, path, IN_MODIFY);

...blkmapd watches for directories to show up in rpc_pipefs and in the
"nfs" directory below that:

    2 utils/blkmapd/device-discovery.c 358 *wd = inotify_add_watch(bl_watch_fd, dir, IN_CREATE|IN_DELETE);

...gssd has a pretty complex set of watches. There is a comment at the
top of gssd.c that explains them, but it watches for directories to
show up under rpc_pipefs, and then sets watches on the files under
those dirs (I think):

    3 utils/gssd/gssd.c                656 clp->wd = inotify_add_watch(inotify_fd, clp->relpath, IN_CREATE | IN_DELETE);
    4 utils/gssd/gssd.c                765 tdi->wd = inotify_add_watch(inotify_fd, name, IN_CREATE);

idmapd watches for dirs to show up in rpc_pipefs/nfs, and then watches
for directories under that to be created:

    5 utils/idmapd/idmapd.c            410 wd = inotify_add_watch(inotify_fd, pipefsdir, IN_CREATE | IN_DELETE);
    6 utils/idmapd/idmapd.c            930 inotify_add_watch(inotify_fd, ic->ic_path, IN_CREATE | IN_ONLYDIR | IN_ONESHOT);

nfsdcld watches for entries to show up in rpc_pipefs/nfsd/cld:

    7 utils/nfsdcld/nfsdcld.c          276 ret = inotify_add_watch(inotify_fd, dname, IN_CREATE);

Al, Let me know if you have more questions, but it may be simpler to
just look in the nfs-utils tree.

Cheers,
-- 
Jeff Layton <jlayton@poochiereds.net>

                 reply	other threads:[~2024-05-16 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=a40089cd2c7d492859dec6a7ef134d8f68aa761d.camel@poochiereds.net \
    --to=jlayton@poochiereds.net \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).