]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - fs/nfs/nfs4proc.c
NFSv4: add flock_owner to open context
authorNeilBrown <neilb@suse.com>
Thu, 13 Oct 2016 04:26:47 +0000 (15:26 +1100)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 1 Dec 2016 22:57:27 +0000 (17:57 -0500)
commit532d4def2f95623a9b8b2cef7723e14521377911
treef596be47ef2cf430d009b7f6d864d9ea7c7dab62
parentb184b5c38e4640585126e44ef84f2dbdd0d23d5a
NFSv4: add flock_owner to open context

An open file description (struct file) in a given process can be
associated with two different lock owners.

It can have a Posix lock owner which will be different in each process
that has a fd on the file.
It can have a Flock owner which will be the same in all processes.

When searching for a lock stateid to use, we need to consider both of these
owners

So add a new "flock_owner" to the "nfs_open_context" (of which there
is one for each open file description).

This flock_owner does not need to be reference-counted as there is a
1-1 relation between 'struct file' and nfs open contexts,
and it will never be part of a list of contexts.  So there is no need
for a 'flock_context' - just the owner is enough.

The io_count included in the (Posix) lock_context provides no
guarantee that all read-aheads that could use the state have
completed, so not supporting it for flock locks in not a serious
problem.  Synchronization between flock and read-ahead can be added
later if needed.

When creating an open_context for a non-openning create call, we don't have
a 'struct file' to pass in, so the lock context gets initialized with
a NULL owner, but this will never be used.

The flock_owner is not used at all in this patch, that will come later.

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/dir.c
fs/nfs/inode.c
fs/nfs/nfs4file.c
fs/nfs/nfs4proc.c
include/linux/nfs_fs.h