[LCP]Checking for local filesystem (or: safe locking)

Jack Lloyd lloyd at acm.jhu.edu
Tue Jul 16 05:23:05 UTC 2002


Problem:

We need to do some kind of locking such that one server runs over a
particular set of files (in this case, a source code repository). More than
one server can run, just not over the same repository.

Current Solution:

Do a lock file. It works, but only on a local filesystem (since we depend
on good timestamps and whatnot).

New Problem:

Need to make sure that the repository is on a local filesystem.

Current Solution:

Use statfs and check for NFS_SUPER_MAGIC. The problem is that NFS is not
the only remote file system in existence, last I checked. Is there a better
solution to this beyond just checking for CODA_SUPER_MAGIC,
SMB_SUPER_MAGIC, etc along with NFS_SUPER_MAGIC?

Offtopic to this list:
On *BSD, we do a statfs and check the flags for MNT_LOCAL. And everywhere
else, we punt and say "yes, it's local". Anyone know of a way to check for
this on Solaris, IRIX, etc? I can't find anything at all for this.





More information about the linuxCprogramming mailing list