···949950 cond_resched_lock(&mm->page_table_lock);951 while (!(page = follow_page(mm, start, write_access))) {00952 /*953 * Shortcut for anonymous pages. We don't want954 * to force the creation of pages tables for···963 break;964 }965 spin_unlock(&mm->page_table_lock);966- switch (__handle_mm_fault(mm, vma, start,967- write_access)) {968- case VM_FAULT_WRITE:969- /*970- * do_wp_page has broken COW when971- * necessary, even if maybe_mkwrite972- * decided not to set pte_write973- */0974 write_access = 0;975- /* FALLTHRU */0976 case VM_FAULT_MINOR:977 tsk->min_flt++;978 break;
···949950 cond_resched_lock(&mm->page_table_lock);951 while (!(page = follow_page(mm, start, write_access))) {952+ int ret;953+954 /*955 * Shortcut for anonymous pages. We don't want956 * to force the creation of pages tables for···961 break;962 }963 spin_unlock(&mm->page_table_lock);964+ ret = __handle_mm_fault(mm, vma, start, write_access);965+966+ /*967+ * The VM_FAULT_WRITE bit tells us that do_wp_page has968+ * broken COW when necessary, even if maybe_mkwrite969+ * decided not to set pte_write. We can thus safely do970+ * subsequent page lookups as if they were reads.971+ */972+ if (ret & VM_FAULT_WRITE)973 write_access = 0;974+975+ switch (ret & ~VM_FAULT_WRITE) {976 case VM_FAULT_MINOR:977 tsk->min_flt++;978 break;