linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ben LaHaise <bcrl@redhat.com>
To: riel@nl.linux.org
Cc: linux-mm@kvack.org, linux-kernel@vger.rutgers.edu
Subject: v2.4.6-pre3 swap cache race
Date: Mon, 18 Jun 2001 22:01:11 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.33.0106182200320.17350-100000@toomuch.toronto.redhat.com> (raw)

diff -urN v2.4.6-pre3/mm/filemap.c swaprace/mm/filemap.c
--- v2.4.6-pre3/mm/filemap.c	Mon Jun 18 21:51:03 2001
+++ swaprace/mm/filemap.c	Mon Jun 18 21:59:57 2001
@@ -714,16 +714,16 @@
  * The SwapCache check is protected by the pagecache lock.
  */
 struct page * __find_get_swapcache_page(struct address_space *mapping,
-			      unsigned long offset, struct page **hash)
+			      unsigned long index, struct page **hash)
 {
 	struct page *page;

 	/*
 	 * We need the LRU lock to protect against page_launder().
 	 */
-
+try_again:
 	spin_lock(&pagecache_lock);
-	page = __find_page_nolock(mapping, offset, *hash);
+	page = __find_page_nolock(mapping, index, *hash);
 	if (page) {
 		spin_lock(&pagemap_lru_lock);
 		if (PageSwapCache(page))
@@ -733,6 +733,16 @@
 		spin_unlock(&pagemap_lru_lock);
 	}
 	spin_unlock(&pagecache_lock);
+
+	if (page) {
+		lock_page(page);
+		if (!PageSwapCache(page) || page->mapping != mapping ||
+		    page->index != index) {
+			UnlockPage(page);
+			goto try_again;
+		}
+		UnlockPage(page);
+	}

 	return page;
 }

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

                 reply	other threads:[~2001-06-19  2:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.33.0106182200320.17350-100000@toomuch.toronto.redhat.com \
    --to=bcrl@redhat.com \
    --cc=linux-kernel@vger.rutgers.edu \
    --cc=linux-mm@kvack.org \
    --cc=riel@nl.linux.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