NFS File identity resolution?

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Mar 15 09:16:42 AEST 1991


In article <21078 at shlump.nac.dec.com> prakash at aiag.enet.dec.com writes:
> Given a set of NFS servers and clients on the same network, and two
> processes A and B on possibly different nodes, which can communicate
> using sockets. How can the two processes determine if a file referred to
> as "/a/b/c/file" by process A is really the file referred to as "/A/B/file"
> by the process B?

You cannot, at least not reliably.

On a single machine, two files are the same if and only if they have the
same device and inode (st_dev and st_ino after stat()). But there are
simply no guarantees of this across multiple machines.

Even if you could find out that the two files were the same, what would
you want to do with the information? NFS doesn't even guarantee that
locks on the file will work right.

Even if you could find out that two pathnames referred to the same file,
and even if you could do something sensible with the file, you wouldn't
want to use the names. What if someone moved the file or unmounted and
remounted the disks in the meantime?

---Dan



More information about the Comp.unix.shell mailing list