linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <dhillf@gmail.com>
To: Linux-MM <linux-mm@kvack.org>
Cc: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Hillf Danton <dhillf@gmail.com>
Subject: [PATCH] mm: shmem: unlock valid page
Date: Sun, 4 Mar 2012 13:17:25 +0800	[thread overview]
Message-ID: <CAJd=RBBYdY1rgoW+0bgKh6Cn8n=guB2_zq2nzaMr8-arqNkr_A@mail.gmail.com> (raw)

In shmem_read_mapping_page_gfp() page is unlocked if no error returned,
so the unlocked page has to valid.

To guarantee that validity, when getting page, success result is feed
back to caller only when page is valid.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/shmem.c	Sun Mar  4 12:17:42 2012
+++ b/mm/shmem.c	Sun Mar  4 12:26:56 2012
@@ -889,13 +889,13 @@ repeat:
 		goto failed;
 	}

-	if (page || (sgp == SGP_READ && !swap.val)) {
+	if (page) {
 		/*
 		 * Once we can get the page lock, it must be uptodate:
 		 * if there were an error in reading back from swap,
 		 * the page would not be inserted into the filecache.
 		 */
-		BUG_ON(page && !PageUptodate(page));
+		BUG_ON(!PageUptodate(page));
 		*pagep = page;
 		return 0;
 	}
--

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2012-03-04  5:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04  5:17 Hillf Danton [this message]
2012-03-04 17:51 ` Hugh Dickins
2012-03-05 12:15   ` Hillf Danton

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='CAJd=RBBYdY1rgoW+0bgKh6Cn8n=guB2_zq2nzaMr8-arqNkr_A@mail.gmail.com' \
    --to=dhillf@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox