Unix Programming - Does flock work on a mounted directory?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > September 2007 > Does flock work on a mounted directory?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Does flock work on a mounted directory?
cestesteban@yahoo.it

2007-09-18, 1:27 pm

I am evaluating to use the UNIX flock on files of a remote mounted
directory.
Can different process, working on different machines, flock files on a
remote mounted directory without interfere each other?
Thanx

Scott Lurndal

2007-09-18, 1:27 pm

cestesteban@yahoo.it writes:
>I am evaluating to use the UNIX flock on files of a remote mounted
>directory.
>Can different process, working on different machines, flock files on a
>remote mounted directory without interfere each other?
>Thanx
>


Depends.

When you say "remote mounted" are you referring to RFS, NFS, AFS or SMB
as the underlying protocol?

RFS (which nobody supports anymore) had locking support iirc.
NFS supports it if both hosts are running compatible lockd instances.
AFS i'm not sure
SMB (aka CIFS) not likely.

scott
Chris Friesen

2007-09-18, 7:19 pm

cestesteban@yahoo.it wrote:

> Can different process, working on different machines, flock files on a
> remote mounted directory without interfere each other?


At least with Linux, flock() is not guaranteed to work with NFS mounts.
fcntl() locks work with NFS, not sure about other network filesystems.

Chris
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com