Whamcloud - gitweb
LU-5291 vvp: Make sure ft_flags is valid 56/10956/3
authorPaul Cassella <cassella@cray.com>
Thu, 3 Jul 2014 19:14:47 +0000 (14:14 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 8 Jul 2014 16:02:15 +0000 (16:02 +0000)
commit6d8d0efa7bc88bfdcfcd96a11dfc3221c985cd0d
tree94c4912ce6e436417f484a31003d5864e971d219
parent79165939172df8c608dd2cb134da1ef7911aaf4b
LU-5291 vvp: Make sure ft_flags is valid

In ll_fault0, the 'fault' struct is mostly cleared before the call to
cl_io_loop, but ft_flags is not reset. It is ordinarily set by
the call to filemap_fault in vvp_io_kernel_fault, but if Lustre
returns before calling filemap_fault, it still has the old value of
ft_flags.

ll_fault0 will then consume the ft_flags field. If it has the
VM_FAULT_RETRY bit set, it will be used as ll_fault0() and
ll_fault()'s return value.

This is a problem when VM_FAULT_RETRY is in ft_flags:
When fault/filemap_fault return with that flag set, they have already
released the mmap semaphore, and do_page_fault does not need to
release it.
Incorrectly returning this flag from ll_fault means mmap_sem
is not upped in the kernel's do_page_fault().

In addition to clearing ft_flags, this patch does not use it unless
it is valid.  It's potentially misleading to return ft_flags in
"fault_ret" if ft_flags has not been set by filemap_fault.

This adds clarity, but does not change the current behavior:
When not valid, ft_flags is replaced by fault_ret, which is zero,
as is ft_flags when not set by filemap_fault.

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: If3a7ad87ee94aff5ecc65429c79e0e595281546d
Reviewed-on: http://review.whamcloud.com/10956
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/llite_internal.h
lustre/llite/llite_mmap.c
lustre/llite/vvp_io.c