linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] swapfile : fix the wrong return value
@ 2010-03-02  3:38 Huang Shijie
  2010-03-04  0:37 ` Hugh Dickins
  2010-03-04  7:14 ` [PATCH] swapfile : export more return values for swap_duplicate() Huang Shijie
  0 siblings, 2 replies; 6+ messages in thread
From: Huang Shijie @ 2010-03-02  3:38 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, hugh.dickins, Huang Shijie

If the __swap_duplicate returns a negative value except of the -ENOMEM,
but the err is zero at this time, the return value of swap_duplicate is
wrong in this situation.

The caller, such as try_to_unmap_one(), will do the wrong operations too
in this situation.

This patch fix it.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
 mm/swapfile.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6c0585b..191d8fa 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2161,7 +2161,7 @@ int swap_duplicate(swp_entry_t entry)
 {
 	int err = 0;
 
-	while (!err && __swap_duplicate(entry, 1) == -ENOMEM)
+	while (!err && (err = __swap_duplicate(entry, 1)) == -ENOMEM)
 		err = add_swap_count_continuation(entry, GFP_ATOMIC);
 	return err;
 }
-- 
1.6.6

--
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] 6+ messages in thread

end of thread, other threads:[~2010-03-04  7:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-02  3:38 [PATCH] swapfile : fix the wrong return value Huang Shijie
2010-03-04  0:37 ` Hugh Dickins
2010-03-04  7:00   ` Huang Shijie
2010-03-04  7:28     ` Hugh Dickins
2010-03-04  7:48       ` Huang Shijie
2010-03-04  7:14 ` [PATCH] swapfile : export more return values for swap_duplicate() Huang Shijie

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