From: Jinshan Xiong Date: Fri, 2 Mar 2012 05:46:18 +0000 (-0800) Subject: LU-1163 llite: never try to invalidate a dirty page X-Git-Tag: 2.1.58~4 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=fdeace7e542360989645ea3dd9954a5f28c681aa;p=fs%2Flustre-release.git LU-1163 llite: never try to invalidate a dirty page When ll_page_mkwrite() detects page's covering lock is being canceled, it should write the page back before invalidating it. Otherwise, it will cause data corruption. Signed-off-by: Jinshan Xiong Change-Id: I345728daacf50edc154cd434dea392410f8cc782 Reviewed-on: http://review.whamcloud.com/2243 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Johann Lombardi --- diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index bdd8f29..fd324ca 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -233,8 +233,12 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, * This piece of code is definitely needed for RHEL5, * otherwise, SIGBUS will be wrongly returned to * applications. */ - ll_invalidate_page(vmpage); - LASSERT(vmpage->mapping == NULL); + write_one_page(vmpage, 1); + lock_page(vmpage); + if (vmpage->mapping != NULL) { + ll_invalidate_page(vmpage); + LASSERT(vmpage->mapping == NULL); + } unlock_page(vmpage); } else if (!PageDirty(vmpage)) { /* race, the page has been cleaned by ptlrpcd after diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index fae6a60..0fb70e7 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8532,7 +8532,8 @@ test_220() { #LU-325 run_test 220 "preallocated MDS objects still used if ENOSPC from OST" test_221() { - cp `which date` $MOUNT + dd if=`which date` of=$MOUNT/date oflag=sync + chmod +x $MOUNT/date #define OBD_FAIL_LLITE_FAULT_TRUNC_RACE 0x1401 $LCTL set_param fail_loc=0x80001401