Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 2013 11:41:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r251178 - stable/9/sys/dev/md
Message-ID:  <201305311141.r4VBf2uL064180@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri May 31 11:41:01 2013
New Revision: 251178
URL: http://svnweb.freebsd.org/changeset/base/251178

Log:
  MFC r250966:
  Fix the data corruption on the swap-backed md. Assign the rv variable a
  success code if the pager was not asked for the page.

Modified:
  stable/9/sys/dev/md/md.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/md/md.c
==============================================================================
--- stable/9/sys/dev/md/md.c	Fri May 31 09:37:33 2013	(r251177)
+++ stable/9/sys/dev/md/md.c	Fri May 31 11:41:01 2013	(r251178)
@@ -669,7 +669,9 @@ mdstart_swap(struct md_s *sc, struct bio
 		sf = sf_buf_alloc(m, SFB_CPUPRIVATE);
 		VM_OBJECT_LOCK(sc->object);
 		if (bp->bio_cmd == BIO_READ) {
-			if (m->valid != VM_PAGE_BITS_ALL)
+			if (m->valid == VM_PAGE_BITS_ALL)
+				rv = VM_PAGER_OK;
+			else
 				rv = vm_pager_get_pages(sc->object, &m, 1, 0);
 			if (rv == VM_PAGER_ERROR) {
 				sf_buf_free(sf);
@@ -691,6 +693,8 @@ mdstart_swap(struct md_s *sc, struct bio
 		} else if (bp->bio_cmd == BIO_WRITE) {
 			if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL)
 				rv = vm_pager_get_pages(sc->object, &m, 1, 0);
+			else
+				rv = VM_PAGER_OK;
 			if (rv == VM_PAGER_ERROR) {
 				sf_buf_free(sf);
 				sched_unpin();
@@ -702,6 +706,8 @@ mdstart_swap(struct md_s *sc, struct bio
 		} else if (bp->bio_cmd == BIO_DELETE) {
 			if (len != PAGE_SIZE && m->valid != VM_PAGE_BITS_ALL)
 				rv = vm_pager_get_pages(sc->object, &m, 1, 0);
+			else
+				rv = VM_PAGER_OK;
 			if (rv == VM_PAGER_ERROR) {
 				sf_buf_free(sf);
 				sched_unpin();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305311141.r4VBf2uL064180>