Whamcloud - gitweb
LU-1978 llite: Fix i_size race with truncate and mkwrite
authormichael.mckay <michael_mckay@xyratex.com>
Wed, 19 Sep 2012 14:54:56 +0000 (10:54 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Nov 2012 18:17:16 +0000 (13:17 -0500)
commit74a7b9cbb2fe1729db7bcf74fef031fed73239d7
tree0288a7114b921bba79411e8a919672cfd8d1dc01
parent185473cd6458f144ab512176c71beb85609b5ed9
LU-1978 llite: Fix i_size race with truncate and mkwrite

These changes address a race between the truncate
process and the mkwrite process. We add an additional
check in the case of a mkwrite to make sure we are not
past the end of the file. While holding the lli_trunc_sem
lock we check the size and make sure we are not past
the end of the file. If we are we return -ENODATA which
will trigger a SIGBUS. This is similar to what occurs in the
ext4 filesystem in these cases. The return status to -ENODATA
which will eventually get mapped to
VM_FAULT_NOPAGE (ll_page_mkwrite()).
The kernel will then return a SIGBUS. These changes
return -ENODATA to ensure we correctly clean up. In the
case of the mapping being null nothing will change.

Xyratex-bug-id: MRP-651
Reviewed-by: Andrew Perepechko <Andrew_Perepechko@xyratex.com>
Reviewed-by: Alexander Zarochentsev <Alexander_Zarochentsev@xyratex.com>
Signed-off-by: Michael McKay <michael_mckay@xyratex.com>
Change-Id: Ice41b20ac16d81be44fb0c6a1bf0da8b2fcf9b7c
Reviewed-on: http://review.whamcloud.com/4044
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/vvp_io.c