[Box Backup] backup on nfs-mounted storage
Thu, 19 Oct 2006 15:53:43 +0100
On 19 Oct 2006, at 11:38, Martin Ebourne wrote:
> Ben Summers <firstname.lastname@example.org> wrote:
>> What happens if you use both? Are the two mechanism independent?
> From the manpage on Linux:
> flock(2) does not lock files over NFS. Use fcntl(2)
> instead: that does
> work over NFS, given a sufficiently recent version of
> Linux and a
> server which supports locking.
> Since kernel 2.0, flock(2) is implemented as a system call
> in its own
> right rather than being emulated in the GNU C library
> as a call to
> fcntl(2). This yields true BSD semantics: there is no
> between the types of lock placed by flock(2) and fcntl(2),
> and flock(2)
> does not detect deadlock.
> Hence the wariness over new holes...
> What does BSD do about file locking over NFS?
Well I think it "works" if you run the right daemons. But "works"
only means "works as well as NFS locking ever does".
The only thing for which locking is actually required is locking
accounts against duplicate write access (assuming that we get rid of
lib/raidfile -- I don't think there's any need for it any more). It
might be better to do the work to replace all RaidFile operations
with normal FileStream operations, check that locking can be done
away with, then implement a better mechanism for locking accounts.
Perhaps something like creating a file called
So, to lock, you create a file with your hostname and PID.
Afterwards, check to see if there is another lock file. If so, delete
yours and try again. Then you just need a mechanism to check for
stale locks. Not so easy if the hostname isn't one for your machine