[DRBD-user] Errors with flock()

Lars Ellenberg Lars.Ellenberg at linbit.com
Thu Jan 11 23:44:10 CET 2007

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.

/ 2006-12-23 12:46:25 +0500
\ Kamran Nisar:
> hi,
> when I forced an artifical failure of the primary, then while accesing the
> secondary <new primary>, i got the error..
> {the take over had been succusfull and the secondary had become primar, and
> the device mounted}
> flock File_name echo "locked"
> flock: No locks available

something was itching in the back of the head all the time.
I just did not know what it was... then I realised:

flock ... nfs ... there had been somehing...


flock is not supposed to work over nfs.
flock is not supposed to work over nfs.
flock is not supposed to work over nfs.

older implementations on linux "just succeeded" without ever actually
getting the lock, some newer implementations give this error when you
try to use flock on nfs...

and some even more recent ones seem to implement flock on nfs by means
of fcntl. which has different semantics yaddayadda...

so, what you should check:
you use a recent kernel?
recent nfs-utils (nfs-kernel-server, nfs-common? 
your portmapper is accessible everywhere?
(you can rpcinfo -p $client on the server for all clients?)
do all clients talk the same protocol version?
do they all implement the same variant of "flock on nfs",
which is broken, was always broken, and keeps being broken?

maybe you can change your apps to use fcntl instead of flock,
avoiding the flock problem completely?

: Lars Ellenberg                            Tel +43-1-8178292-0  :
: LINBIT Information Technologies GmbH      Fax +43-1-8178292-82 :
: Vivenotgasse 48, A-1120 Vienna/Europe    http://www.linbit.com :
please use the "List-Reply" function of your email client.

More information about the drbd-user mailing list