All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Stornelli <marco.stornelli@gmail.com>
To: Linux FS Devel <linux-fsdevel@vger.kernel.org>
Cc: Mike Snitzer <snitzer@redhat.com>,
	Alasdair G Kergon <agk@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Jan Kara <jack@suse.cz>
Subject: [PATCH 4/4] fsfreeze: avoid to return zero in __get_user_pages
Date: Sat, 06 Apr 2013 12:07:08 +0200	[thread overview]
Message-ID: <515FF3CC.80106@gmail.com> (raw)

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

WARNING: multiple messages have this Message-ID (diff)
From: Marco Stornelli <marco.stornelli@gmail.com>
To: Linux FS Devel <linux-fsdevel@vger.kernel.org>
Cc: Mike Snitzer <snitzer@redhat.com>,
	Alasdair G Kergon <agk@redhat.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Jan Kara <jack@suse.cz>
Subject: [PATCH 4/4] fsfreeze: avoid to return zero in __get_user_pages
Date: Sat, 06 Apr 2013 12:07:08 +0200	[thread overview]
Message-ID: <515FF3CC.80106@gmail.com> (raw)

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>

             reply	other threads:[~2013-04-06 10:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-06 10:07 Marco Stornelli [this message]
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
2013-04-06 17:36   ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=515FF3CC.80106@gmail.com \
    --to=marco.stornelli@gmail.com \
    --cc=agk@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.