- CDEBUG(D_MMAP, "%s mkwrite with %d\n", cfs_current()->comm, result);
-
- LASSERT(ergo(result == 0, PageLocked(vmpage)));
- return(result);
-}
-
-
-#ifndef HAVE_VM_OP_FAULT
-/**
- * Lustre implementation of a vm_operations_struct::nopage() method, called by
- * VM to server page fault (both in kernel and user space).
- *
- * This function sets up CIT_FAULT cl_io that does the job.
- *
- * \param vma - is virtiual area struct related to page fault
- * \param address - address when hit fault
- * \param type - of fault
- *
- * \return allocated and filled _unlocked_ 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)
-{
- struct lu_env *env;
- struct cl_env_nest nest;
- struct cl_io *io;
- struct page *page = NOPAGE_SIGBUS;
- struct vvp_io *vio = NULL;
- unsigned long ra_flags;
- pgoff_t pg_offset;
- int result;
- const unsigned long writable = VM_SHARED|VM_WRITE;
- cfs_sigset_t set;
- ENTRY;
-
- pg_offset = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
- io = ll_fault_io_init(vma, &env, &nest, pg_offset, &ra_flags);
- if (IS_ERR(io))
- return NOPAGE_SIGBUS;
-
- result = io->ci_result;
- if (result < 0)
- goto out_err;
-
- io->u.ci_fault.ft_writable = (vma->vm_flags&writable) == writable;
-
- vio = vvp_env_io(env);
- vio->u.fault.ft_vma = vma;
- vio->u.fault.nopage.ft_address = address;
- vio->u.fault.nopage.ft_type = type;
- vio->u.fault.ft_vmpage = NULL;
-
- set = cfs_block_sigsinv(sigmask(SIGKILL)|sigmask(SIGTERM));
- result = cl_io_loop(env, io);
- cfs_restore_sigs(set);
-
- page = vio->u.fault.ft_vmpage;
- if (result != 0 && page != NULL) {
- page_cache_release(page);
- page = NOPAGE_SIGBUS;
+ /* if page has been unmapped, presumably due to lock reclaim for
+ * concurrent usage, add some delay before retrying to prevent
+ * entering live-lock situation with competitors
+ */
+ if (result == -ENODATA && inode != NULL) {
+ CDEBUG(D_MMAP, "delaying new page-fault for inode %p to "
+ "prevent live-lock\n", inode);
+ msleep(10);