android_kernel_google_msm/fs/lockd
NeilBrown cc01cae918 lockd: send correct lock when granting a delayed lock.
commit 2ec197db1a upstream.

If an NFS client attempts to get a lock (using NLM) and the lock is
not available, the server will remember the request and when the lock
becomes available it will send a GRANT request to the client to
provide the lock.

If the client already held an adjacent lock, the GRANT callback will
report the union of the existing and new locks, which can confuse the
client.

This happens because __posix_lock_file (called by vfs_lock_file)
updates the passed-in file_lock structure when adjacent or
over-lapping locks are found.

To avoid this problem we take a copy of the two fields that can
be changed (fl_start and fl_end) before the call and restore them
afterwards.
An alternate would be to allocate a 'struct file_lock', initialise it,
use locks_copy_lock() to take a copy, then locks_release_private()
after the vfs_lock_file() call.  But that is a lot more work.

Reported-by: Olaf Kirch <okir@suse.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

--
v1 had a couple of issues (large on-stack struct and didn't really work properly).
This version is much better tested.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2014-02-22 10:32:45 -08:00
..
clnt4xdr.c lockd: fix the endianness bug 2012-04-13 13:50:52 -04:00
clntlock.c LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot 2013-05-07 19:51:56 -07:00
clntproc.c LOCKD: Ensure that nlmclnt_block resets block->b_status after a server reboot 2013-05-07 19:51:56 -07:00
clntxdr.c NLM: nlm_lookup_file() may return NLMv4-specific error codes 2012-10-28 10:14:13 -07:00
grace.c
host.c Lockd: shutdown NLM hosts in network namespace context 2012-02-15 00:19:48 -05:00
Makefile
mon.c lockd: use rpc client's cl_nodename for id encoding 2012-10-21 09:27:57 -07:00
netns.h Lockd: pernet usage counter introduced 2012-02-15 00:19:47 -05:00
svc.c LockD: pass service to per-net up and down functions 2012-10-02 10:30:48 -07:00
svc4proc.c lockd: Clean up nlmsvc_lookup_host() 2010-12-16 12:37:26 -05:00
svclock.c lockd: send correct lock when granting a delayed lock. 2014-02-22 10:32:45 -08:00
svcproc.c NLM: nlm_lookup_file() may return NLMv4-specific error codes 2012-10-28 10:14:13 -07:00
svcshare.c
svcsubs.c vfs: prefer ->dentry->d_sb to ->mnt->mnt_sb 2012-01-06 23:16:53 -05:00
xdr.c lockd: Move nlmdbg_cookie2a() to svclock.c 2010-12-16 12:37:24 -05:00
xdr4.c