determining nfs mount from struct stat

From: bill pursell (bill.pursell_at_gmail.com)
Date: 11/26/05


Date: 26 Nov 2005 00:51:38 -0800

I have an open file descriptor for a directory, and I would like to
call fcntl to put an F_NOTIFY on it. Since the notification will fail
if the directory is NFS mounted (or rather, no notification will
occur), I'd like to check that first. That is, I'd like to check if
the file descriptor refers to a directory that is on a local device or
a networked device (eg nfs). I can call fstat for the file descriptor,
and that gives me the device number (st_dev), but I'm not sure how to
use that. I think this becomes moot with inotify, but we're still
running 2.6.9 kernels, so that's not an option. Also, this is
something I should know how to do.

Any pointers appreciated.



Relevant Pages

  • Re: determining nfs mount from struct stat
    ... > call fcntl to put an F_NOTIFY on it. ... Since the notification will fail ... > if the directory is NFS mounted (or rather, no notification will ... I can call fstat for the file descriptor, ...
    (comp.os.linux.development.apps)
  • Re: fanotify - overall design before I start sending patches
    ... the describes what happened it also comes with an open file descriptor ... These are the only 4 where the notification hook has enough ... In the kernel most notification is done with either an inode or a dentry ...
    (Linux-Kernel)
  • [RFC, PATCH] netlink based mq_notify(SIGEV_THREAD)
    ... mq_notifymust be implemented in user space. ... notification callback. ... uses single shot file descriptor - it works, ... +struct sock *netlink_getsockbyfilp; ...
    (Linux-Kernel)
  • Re: fanotify - overall design before I start sending patches
    ... the describes what happened it also comes with an open file descriptor ... These are the only 4 where the notification hook has enough ... In the kernel most notification is done with either an inode or a dentry ...
    (Linux-Kernel)
  • Re: [PATCH 1/1] Memory usage limit notification addition to memcg
    ... I know people likes to wait for file descriptor to get notification in these days. ... cross X threshold" file for each numeric usage value that people might ... automatic wakeup when a cgroup is removed ...
    (Linux-Kernel)