Can't get NFS file locking to work

I mount a ShareSpace using NFS, but I can’t get

file locking to work.

On the client, the system call fcntl(,F_SETLK,)

returns ENOLCK (No locks available).

On the ShareSpace, I turned on all sorts of

debugging. (cd /proc/sys/sunrpc; echo 1 > nlm_debug,

etc.)

Now dmesg (on the ShareSpace) shows this every time

a lock request comes in:

nsm_mon_unmon: rpc failed, status=-13
lockd: cannot monitor 192.168.2.2

(The IP address is that of the client)

Googling for this message reveals the cause to be

that statd is not running on the server.  Indeed, it

isn’t.  But I can’t start it, because the ShareSpace

firmware does not contain /usr/sbin/rpc.statd.

(There are only /usr/sbin/rpc.nfsd and /usr/sbin/rpc.mountd.)

I downloaded the source code to the ShareSpace firmware

but didn’t get very far trying to cross-compile statd from the

sources.

Is my diagnosis correct, and, if so, would it be possible to

get an upgrade to the firmware that includes statd?

what is the firmware you are running?

I have a WD Sharespace with 2.2.91 with MioNet 4.3.1.7 and I am having the same problem with not being able to lock files on an nfs share. It seems lockd is running on the Sharespace device.

ps -e | grep “lock”

shows at least something called lockd running. If it is correct one, i do not know …

dmesg has the following errors repeated many times on the Sharespace device:

lockd: cannot monitor 192.168.1.10

nsm_mon_unmon: rpc failed, status=-13

and every time something on the client needs a lock I get;

flock -e test -c ls

flock: test: No locks available

In order to get around this problem, I am mounting the nfs folders with a nolock option.

Also, I don’t understand why this problem is happening if lockd is running on the device.

Hopefully WD can provide a fix soon. Or at least provide a better workaround.

I gave up.

For reference: I am using the latest firmware (“2.2.91 with MioNet 4.3.1.7”).

I already explained why locking doesn’t work: there is no statd.

It is not sufficient to run lockd.

See, e.g.:

http://lkml.indiana.edu/hypermail/linux/kernel/9712.1/0483.html