lkml.org 
[lkml]   [2006]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file content corruption on ext3)
    From
    Date
    On Fri, 2006-12-22 at 13:59 +0100, Martin Michlmayr wrote:
    > * Martin Michlmayr <tbm@cyrius.com> [2006-12-22 13:32]:
    > > I've completed one installation with Linus' patch plus the two from
    > > Andrew successfully, but I'm currently trying again...
    >
    > .... and it failed.

    Since you are on ARM you might want to try with the page_mkclean_one
    cleanup patch too.

    Arjan agreed that the loop is not needed; we clear the pte, flush on all
    CPUs and then re-establish the pte. Any race will fault and be
    serialised on the pte lock.

    FWIW - with todays -git and Andrews second cancel_dirty_page() patch:
    http://lkml.org/lkml/2006/12/22/49
    I am unable to trigger any corruption - I could again earlier by raising
    the number of seeds from 3 to 6. (am currently at 10 seeds)




    From: Peter Zijlstra <a.p.zijlstra@chello.nl>

    fix page_mkclean_one()

    - add flush_cache_page() for all those virtual indexed cache
    architectures.

    - handle s390.

    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    ---
    mm/rmap.c | 38 +++++++++++++++++++++++++-------------
    1 file changed, 25 insertions(+), 13 deletions(-)

    Index: linux-2.6/mm/rmap.c
    ===================================================================
    --- linux-2.6.orig/mm/rmap.c
    +++ linux-2.6/mm/rmap.c
    @@ -432,7 +432,7 @@ static int page_mkclean_one(struct page
    {
    struct mm_struct *mm = vma->vm_mm;
    unsigned long address;
    - pte_t *pte, entry;
    + pte_t *pte;
    spinlock_t *ptl;
    int ret = 0;

    @@ -444,17 +444,18 @@ static int page_mkclean_one(struct page
    if (!pte)
    goto out;

    - if (!pte_dirty(*pte) && !pte_write(*pte))
    - goto unlock;
    + if (pte_dirty(*pte) || pte_write(*pte)) {
    + pte_t entry;

    - entry = ptep_get_and_clear(mm, address, pte);
    - entry = pte_mkclean(entry);
    - entry = pte_wrprotect(entry);
    - ptep_establish(vma, address, pte, entry);
    - lazy_mmu_prot_update(entry);
    - ret = 1;
    + flush_cache_page(vma, address, pte_pfn(*pte));
    + entry = ptep_clear_flush(vma, address, pte);
    + entry = pte_wrprotect(entry);
    + entry = pte_mkclean(entry);
    + set_pte_at(vma, address, pte, entry);
    + lazy_mmu_prot_update(entry);
    + ret = 1;
    + }

    -unlock:
    pte_unmap_unlock(pte, ptl);
    out:
    return ret;
    @@ -489,6 +490,8 @@ int page_mkclean(struct page *page)
    if (mapping)
    ret = page_mkclean_file(mapping, page);
    }
    + if (page_test_and_clear_dirty(page))
    + ret = 1;

    return ret;
    }



    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-12-22 14:33    [W:0.027 / U:118.652 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site