X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fllite_mmap.c;h=6ce0587a6a27f6266c0e2d02d3ff523232dfd899;hb=1cea1eba5822af001eeba753630876ad121108ee;hp=9de415da8f704379d7d1551834fe1724b0b31d70;hpb=51b1da4054704d0e115ddb2c8857c5a84c7ed958;p=fs%2Flustre-release.git diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c index 9de415d..6ce0587 100644 --- a/lustre/llite/llite_mmap.c +++ b/lustre/llite/llite_mmap.c @@ -29,8 +29,7 @@ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011 Whamcloud, Inc. - * + * Copyright (c) 2011, 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -234,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 @@ -331,35 +334,6 @@ out_err: RETURN(page); } -static int ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage) -{ - int count = 0; - bool printed = false; - bool retry; - int result; - - do { - retry = false; - result = ll_page_mkwrite0(vma, vmpage, &retry); - - if (!printed && ++count > 16) { - CWARN("app(%s): the page %lu of file %lu is under heavy" - " contention.\n", - current->comm, page_index(vmpage), - vma->vm_file->f_dentry->d_inode->i_ino); - printed = true; - } - } while (retry); - - if (result == 0) - unlock_page(vmpage); - else if (result == -ENODATA) - result = 0; /* kernel will know truncate has happened and - * retry */ - - return result; -} - #else /** * Lustre implementation of a vm_operations_struct::fault() method, called by @@ -454,7 +428,38 @@ restart: } return result; } +#endif + +#ifndef HAVE_PGMKWRITE_USE_VMFAULT +static int ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage) +{ + int count = 0; + bool printed = false; + bool retry; + int result; + + do { + retry = false; + result = ll_page_mkwrite0(vma, vmpage, &retry); + + if (!printed && ++count > 16) { + CWARN("app(%s): the page %lu of file %lu is under heavy" + " contention.\n", + current->comm, page_index(vmpage), + vma->vm_file->f_dentry->d_inode->i_ino); + printed = true; + } + } while (retry); + if (result == 0) + unlock_page(vmpage); + else if (result == -ENODATA) + result = 0; /* kernel will know truncate has happened and + * retry */ + + return result; +} +#else static int ll_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) { int count = 0;