Whamcloud - gitweb
LU-1163 llite: never try to invalidate a dirty page
authorJinshan Xiong <jinshan.xiong@whamcloud.com>
Fri, 2 Mar 2012 05:46:18 +0000 (21:46 -0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 5 Mar 2012 00:53:14 +0000 (19:53 -0500)
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 <jinshan.xiong@whamcloud.com>
Change-Id: I345728daacf50edc154cd434dea392410f8cc782
Reviewed-on: http://review.whamcloud.com/2243
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/llite/llite_mmap.c
lustre/tests/sanity.sh

index bdd8f29..fd324ca 100644 (file)
@@ -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
index fae6a60..0fb70e7 100644 (file)
@@ -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