/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
- * Copyright (c) 2001-2003 Cluster File Systems, Inc.
+ * GPL HEADER START
*
- * This file is part of Lustre, http://www.lustre.org.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Lustre is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
*
- * Lustre is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
*
- * You should have received a copy of the GNU General Public License
- * along with Lustre; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see [sun.com URL with a
+ * copy of GPLv2].
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Use is subject to license terms.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
*/
#ifndef AUTOCONF_INCLUDED
#include <linux/fs.h>
#include <linux/stat.h>
#include <asm/uaccess.h>
-#include <asm/segment.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
RETURN(ret);
}
+int ll_region_mapped(unsigned long addr, size_t count)
+{
+ return !!our_vma(addr, count);
+}
+
int lt_get_mmap_locks(struct ll_lock_tree *tree,
unsigned long addr, size_t count)
{
RETURN(0);
}
-/* FIXME: there is a pagefault race goes as follow (only 2.4):
- * 1. A user process on node A accesses a portion of a mapped file,
- * resulting in a page fault. The pagefault handler invokes the
- * ll_nopage function, which reads the page into memory.
- * 2. A user process on node B writes to the same portion of the file
- * (either via mmap or write()), that cause node A to cancel the
- * lock and truncate the page.
- * 3. Node A then executes the rest of do_no_page(), entering the
- * now-invalid page into the PTEs.
+/**
+ * Page fault handler.
*
- * Make the whole do_no_page as a hook to cover both the page cache
- * and page mapping installing with dlm lock would eliminate this race.
+ * \param vma - is virtiual area struct related to page fault
+ * \param address - address when hit fault
+ * \param type - of fault
*
- * In 2.6, the truncate_count of address_space can cover this race.
+ * \return allocated and filled page for address
+ * \retval NOPAGE_SIGBUS if page not exist on this address
+ * \retval NOPAGE_OOM not have memory for allocate new page
*/
struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
int *type)
RETURN(NULL);
}
+ ll_clear_file_contended(inode);
+
/* start and end the lock on the first and last bytes in the page */
policy_from_vma(&policy, vma, address, CFS_PAGE_SIZE);
vma->vm_flags |= VM_RAND_READ;
page = filemap_nopage(vma, address, type);
- LL_CDEBUG_PAGE(D_PAGE, page, "got addr %lu type %lx\n", address,
- (long)type);
+ if (page != NOPAGE_SIGBUS && page != NOPAGE_OOM)
+ LL_CDEBUG_PAGE(D_PAGE, page, "got addr %lu type %lx\n", address,
+ (long)type);
+ else
+ CDEBUG(D_PAGE, "got addr %lu type %lx - SIGBUS\n", address,
+ (long)type);
+
vma->vm_flags &= ~VM_RAND_READ;
vma->vm_flags |= (rand_read | seq_read);