Whamcloud - gitweb
LU-6179 llite: Implement ladvise lockahead 64/13564/102
authorPatrick Farrell <paf@cray.com>
Thu, 14 Sep 2017 15:24:50 +0000 (10:24 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 21 Sep 2017 06:12:44 +0000 (06:12 +0000)
commita8dcf372f430c308d3e96fb506563068d0a80c2d
tree468d67309f5e0900bdcf87fc1d3db83687c4246e
parentf6b0e358f304b006dd24524503bb16d649c5499d
LU-6179 llite: Implement ladvise lockahead

Ladvise lockahead is a new feature allowing userspace to
request extent locks in advance of the IO which will use
them. These locks are not expanded beyond the size
requested by userspace.  They are intended to make it
possible to address lock contention between multiple
clients resulting from lock expansion.  They should allow
optimizing various IO patterns, notably strided writing.
(Further information in LU-6179)

Asynchronous glimpse locks are a speculative version of
glimpse locks, and already implement the required behavior.
Lockahead requests share this behavior.

Additionally, lockahead creates extent locks in advance
of IO, and so breaks the assumption that the holder of the
highest lock knows the current file size.

So we also modify the ofd_intent_policy code to glimpse
PW locks until it finds one it knows to be in use, taking
care to send only one glimpse to each client.

The current patch allows asynchronous non-blocking lock
ahead requests and synchronous blocking requests.  We
cannot do asynchronous blocking requests, because of
deadlocks that occur in having ptlrpcd threads handle
blocking lock requests.

Finally, this patch also adds another advice to disable
lock expansion, setting a per-file descriptor flag.  This
allows user space to control whether or not lock requests
on this file descriptor will undergo lock expansion.

This means if lockahead locks are not created ahead of IO
(due to inherent raciness) or are cancelled by a competing
IO request, the IO requests that should have used the
manually requested locks will not result in expanded locks.
This avoids lock ping-pong, and because the resulting locks
will not extend to the end of the file, future lockahead
requests can be granted.  Effectively, this means that if
lockahead usage for strided IO is interrupted by a
competing request, it can re-assert itself.

lockahead is implented via the ladvise interface from
userspace.  As lockahead results in a DLM lock request
rather than file advice, we do not use the lower levels of
the ladvise implementation.

Note this patch has one oddity:
Cray released an earlier version of lockahead without
FL_SPECULATIVE support.  That version uses
OBD_CONNECT_LOCKAHEAD_OLD, this new one uses
OBD_CONNECT_LOCKAHEAD.

The client code in this patch is interoperable with that
version, so it also advertises OBD_CONNECT_LOCKAHEAD_OLD
support, but the server version is not, so the server
advertises only OBD_CONNECT_LOCKAHEAD support.

Client support for the original lockahead is slated for
removal after the release of 2.12.  This is enforced with
a compile time version test that will remove support.

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: I1e80286f54946a0df08b19b1339829fcfd1117e7
Reviewed-on: https://review.whamcloud.com/13564
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
36 files changed:
Documentation/ladvise_lockahead.txt [new file with mode: 0644]
lustre/contrib/wireshark/lustre_dlm_flags_wshark.c
lustre/doc/lfs-ladvise.1
lustre/include/cl_object.h
lustre/include/lustre_dlm.h
lustre/include/lustre_dlm_flags.h
lustre/include/lustre_export.h
lustre/include/lustre_osc.h
lustre/include/obd_support.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/ldlm/ldlm_extent.c
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lock.c
lustre/llite/file.c
lustre/llite/glimpse.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/vvp_io.c
lustre/lov/lov_io.c
lustre/obdclass/cl_lock.c
lustre/obdclass/lprocfs_status.c
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_dlm.c
lustre/ofd/ofd_internal.h
lustre/osc/osc_internal.h
lustre/osc/osc_lock.c
lustre/osc/osc_request.c
lustre/ptlrpc/wiretest.c
lustre/tests/Makefile.am
lustre/tests/lockahead_test.c [new file with mode: 0644]
lustre/tests/sanity.sh
lustre/utils/lfs.c
lustre/utils/liblustreapi_ladvise.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c