linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] fsfreeze: avoid to return zero in __get_user_pages
@ 2013-04-06 10:07 Marco Stornelli
  2013-04-06 17:36 ` KOSAKI Motohiro
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Stornelli @ 2013-04-06 10:07 UTC (permalink / raw)
  To: Linux FS Devel
  Cc: Mike Snitzer, Alasdair G Kergon, linux-mm, linux-kernel, Jan Kara

In case of VM_FAULT_RETRY, __get_user_pages returns the number
of pages alredy gotten, but there isn't a check if this number is
zero. Instead, we have to return a proper error code so we can avoid
a possible extra call of __get_user_pages. There are several
places where get_user_pages is called inside a loop until all the
pages requested are gotten or an error code is returned.

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
 mm/memory.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 494526a..cca14ed 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1858,7 +1858,7 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 				if (ret & VM_FAULT_RETRY) {
 					if (nonblocking)
 						*nonblocking = 0;
-					return i;
+					return i ? i : -ERESTARTSYS;
 				}
 
 				/*
-- 
1.7.3.4

--
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

end of thread, other threads:[~2013-04-06 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-06 10:07 [PATCH 4/4] fsfreeze: avoid to return zero in __get_user_pages Marco Stornelli
2013-04-06 17:36 ` KOSAKI Motohiro

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).