Skip to contentSkip to conversation

local_lock mount option

DISCUSSION Lukas Hejtmanek 3 participants 7 messages Dec 13, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

is this option supported and should work?

It seems that in SLES and RHEL kernel, it is ignored:
mount nfs.server:/ /storage -t nfs4 -o sec=krb5,local_lock=all

cat /proc/mounts | grep storage
nfs.server:/ /storage nfs4 rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=krb5,clientaddr=xxx.xxx.xxx.xxx,minorversion=0,local_lock=none,addr=xxx.xxx.xxx.xxx 0 0

and it seems, that it actually tries to lock through NFS.

Has this been fixed in later kernels or this is broken at all?

Signature · 1 line
Lukáš Hejtmánek
#1 lore raw
Quoted 11 lines · Lukas Hejtmanek

Hi,

is this option supported and should work?

It seems that in SLES and RHEL kernel, it is ignored:
mount nfs.server:/ /storage -t nfs4 -o sec=krb5,local_lock=all

cat /proc/mounts | grep storage
nfs.server:/ /storage nfs4 rw,relatime,vers=4,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=krb5,clientaddr=xxx.xxx.xxx.xxx,minorversion=0,local_lock=none,addr=xxx.xxx.xxx.xxx 0 0

Quoted 5 lines

and it seems, that it actually tries to lock through NFS.

Has this been fixed in later kernels or this is broken at all?

--

local_lock is a v2/v3 option. It does not currently effect the behavior of v4.

Fred

#2 lore raw
Quoted 1 line · Fred Isaman

local_lock is a v2/v3 option. It does not currently effect the behavior of v4.

if I understand correctly source codes, it should:
nfs/file.c:

const struct file_operations nfs4_file_operations = { [...]
.lock = nfs_lock,
.flock = nfs_flock,

and nfs_(f)lock contains tests for:
NFS_MOUNT_LOCAL_FCNTL
NFS_MOUNT_LOCAL_FLOCK

but for some reason, it is not propageted from mount call. Dunno why. Or am I something missing?

Signature · 1 line
Lukáš Hejtmánek
#3 lore raw
Quoted 15 lines · Lukas Hejtmanek
Quoted 1 line · Fred Isaman

local_lock is a v2/v3 option. It does not currently effect the behavior of v4.

if I understand correctly source codes, it should:
nfs/file.c:

const struct file_operations nfs4_file_operations = { [...]
.lock = nfs_lock,
.flock = nfs_flock,

and nfs_(f)lock contains tests for:
NFS_MOUNT_LOCAL_FCNTL
NFS_MOUNT_LOCAL_FLOCK

Quoted 5 lines

but for some reason, it is not propageted from mount call. Dunno why. Or am I something missing?

--
Lukáš Hejtmánek

It is turned off here:

static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args)

{
	args->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3|
			 NFS_MOUNT_LOCAL_FLOCK|NFS_MOUNT_LOCAL_FCNTL);
}

Fred

#4 lore raw
Quoted 7 lines · Fred Isaman

It is turned off here:

static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args)

{
	args->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3|
			 NFS_MOUNT_LOCAL_FLOCK|NFS_MOUNT_LOCAL_FCNTL);
}

ok, thanks. Is there any reason for this? I need to turn of locks for NFSv4 as they seem to not work properly with NFS server on CXFS.

Signature · 1 line
Lukáš Hejtmánek
#5 lore raw
Quoted 9 lines · Lukas Hejtmanek
Quoted 7 lines · Fred Isaman

It is turned off here:

static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args)

{
      args->flags &= ~(NFS_MOUNT_NONLM|NFS_MOUNT_NOACL|NFS_MOUNT_VER3|
                       NFS_MOUNT_LOCAL_FLOCK|NFS_MOUNT_LOCAL_FCNTL);
}
Quoted 5 lines

ok, thanks. Is there any reason for this? I need to turn of locks for NFSv4 as they seem to not work properly with NFS server on CXFS.

--
Lukáš Hejtmánek

The idea is that delegations are a better way to decide whether the client should cache locks.

Fred

#6 lore raw
Quoted 2 lines · Fred Isaman

The idea is that delegations are a better way to decide whether the client should cache locks.

well, but I need to fake locks on client, i.e., client's lock always succeeds independently of NFS server. I know that's wrong approchach but until I got fix for NFS+CXFS, I dont' see any other option. And I believe that local_locks=any does exactly what I need.

Signature · 1 line
Lukáš Hejtmánek