2012-12-13 13:52:07

by Lukas Hejtmanek

[permalink] [raw]
Subject: local_lock mount option

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?

--
Luk?? Hejtm?nek


2012-12-13 14:48:26

by Fred Isaman

[permalink] [raw]
Subject: Re: local_lock mount option

On Thu, Dec 13, 2012 at 9:40 AM, Lukas Hejtmanek <[email protected]> wrote:
> On Thu, Dec 13, 2012 at 09:38:04AM -0500, Fred Isaman wrote:
>> 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.
>
> --
> Lukáš Hejtmánek

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

Fred

2012-12-13 14:56:25

by Lukas Hejtmanek

[permalink] [raw]
Subject: Re: local_lock mount option

On Thu, Dec 13, 2012 at 09:48:25AM -0500, Fred Isaman wrote:
> 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.

--
Luk?? Hejtm?nek

2012-12-13 14:18:09

by Fred Isaman

[permalink] [raw]
Subject: Re: local_lock mount option

On Thu, Dec 13, 2012 at 8:35 AM, Lukas Hejtmanek <[email protected]> wrote:
> 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?
>
> --

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

Fred

2012-12-13 14:50:04

by Lukas Hejtmanek

[permalink] [raw]
Subject: Re: local_lock mount option

On Thu, Dec 13, 2012 at 09:10:14AM -0500, Fred Isaman wrote:
> 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?

--
Luk?? Hejtm?nek

2012-12-13 14:38:05

by Fred Isaman

[permalink] [raw]
Subject: Re: local_lock mount option

On Thu, Dec 13, 2012 at 9:23 AM, Lukas Hejtmanek <[email protected]> wrote:
> On Thu, Dec 13, 2012 at 09:10:14AM -0500, Fred Isaman wrote:
>> 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?
>
> --
> 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

2012-12-13 14:40:29

by Lukas Hejtmanek

[permalink] [raw]
Subject: Re: local_lock mount option

On Thu, Dec 13, 2012 at 09:38:04AM -0500, Fred Isaman wrote:
> 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.

--
Luk?? Hejtm?nek