diff options
author | NeilBrown <neilb@suse.de> | 2014-02-07 17:10:26 +1100 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-02-13 14:55:02 -0500 |
commit | 2ec197db1a56c9269d75e965f14c344b58b2a4f6 (patch) | |
tree | de33f16ea4f62413085f1572481de76b2e7533ec /fs/ubifs | |
parent | 09bdc2d70dedd0fc0358da93bca664c7b11ff907 (diff) | |
download | op-kernel-dev-2ec197db1a56c9269d75e965f14c344b58b2a4f6.zip op-kernel-dev-2ec197db1a56c9269d75e965f14c344b58b2a4f6.tar.gz |
lockd: send correct lock when granting a delayed lock.
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>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
--
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>
Diffstat (limited to 'fs/ubifs')
0 files changed, 0 insertions, 0 deletions