linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] add vma->ops check before do_nonlinear_fault()
@ 2009-09-09 16:18 Boll Liu
  2009-09-09 16:25 ` Nick Piggin
  0 siblings, 1 reply; 2+ messages in thread
From: Boll Liu @ 2009-09-09 16:18 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, npiggin, kamezawa.hiroyu, Boll Liu

Function do_nonlinear_fault() will also call vma->vm_ops->fault().
So add vma->ops and vma->vm_ops->fault check the same as before
calling do_nonlinear_fault().

Signed-off-by: Boll Liu <BollLiu@gmail.com>
---
 mm/memory.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index aede2ce..86ebdd6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2921,9 +2921,13 @@ static inline int handle_pte_fault(struct mm_struct *mm,
 			return do_anonymous_page(mm, vma, address,
 						 pte, pmd, flags);
 		}
-		if (pte_file(entry))
-			return do_nonlinear_fault(mm, vma, address,
-					pte, pmd, flags, entry);
+		if (pte_file(entry)) {
+			if (vma->vm_ops) {
+				if (likely(vma->vm_ops->fault))
+					return do_nonlinear_fault(mm, vma, address,
+						pte, pmd, flags, entry);
+			}
+		}
 		return do_swap_page(mm, vma, address,
 					pte, pmd, flags, entry);
 	}
-- 
1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] add vma->ops check before do_nonlinear_fault()
  2009-09-09 16:18 [PATCH] add vma->ops check before do_nonlinear_fault() Boll Liu
@ 2009-09-09 16:25 ` Nick Piggin
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Piggin @ 2009-09-09 16:25 UTC (permalink / raw)
  To: Boll Liu; +Cc: akpm, linux-mm, kamezawa.hiroyu

On Thu, Sep 10, 2009 at 12:18:14AM +0800, Boll Liu wrote:
> Function do_nonlinear_fault() will also call vma->vm_ops->fault().
> So add vma->ops and vma->vm_ops->fault check the same as before
> calling do_nonlinear_fault().

I don't think we'd ever install a pte_file entry there for a
filesystem that cannot handle it (ie. does not have a ->fault).
So I don't think this is needed.

> 
> Signed-off-by: Boll Liu <BollLiu@gmail.com>
> ---
>  mm/memory.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index aede2ce..86ebdd6 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2921,9 +2921,13 @@ static inline int handle_pte_fault(struct mm_struct *mm,
>  			return do_anonymous_page(mm, vma, address,
>  						 pte, pmd, flags);
>  		}
> -		if (pte_file(entry))
> -			return do_nonlinear_fault(mm, vma, address,
> -					pte, pmd, flags, entry);
> +		if (pte_file(entry)) {
> +			if (vma->vm_ops) {
> +				if (likely(vma->vm_ops->fault))
> +					return do_nonlinear_fault(mm, vma, address,
> +						pte, pmd, flags, entry);
> +			}
> +		}
>  		return do_swap_page(mm, vma, address,
>  					pte, pmd, flags, entry);
>  	}
> -- 
> 1.5.6.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-09-09 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-09 16:18 [PATCH] add vma->ops check before do_nonlinear_fault() Boll Liu
2009-09-09 16:25 ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).