summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2002-08-02 05:23:58 +0000
committeralc <alc@FreeBSD.org>2002-08-02 05:23:58 +0000
commit69425db61b078184b18c397d45b84d749a6f0b0c (patch)
tree8154b3d33efd893ac14b8d1d334d31514a435d08
parenta15cfdccfbf5cab416e0549067bea309ff990d9b (diff)
downloadFreeBSD-src-69425db61b078184b18c397d45b84d749a6f0b0c.zip
FreeBSD-src-69425db61b078184b18c397d45b84d749a6f0b0c.tar.gz
o Lock page queue accesses in nwfs and smbfs.
o Assert that the page queues lock is held in vm_page_deactivate().
-rw-r--r--sys/fs/nwfs/nwfs_io.c4
-rw-r--r--sys/fs/smbfs/smbfs_io.c8
-rw-r--r--sys/vm/vm_page.c2
3 files changed, 13 insertions, 1 deletions
diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c
index ff33fc3..9c7d5fa 100644
--- a/sys/fs/nwfs/nwfs_io.c
+++ b/sys/fs/nwfs/nwfs_io.c
@@ -441,15 +441,18 @@ nwfs_getpages(ap)
if (error && (uio.uio_resid == count)) {
printf("nwfs_getpages: error %d\n",error);
+ vm_page_lock_queues();
for (i = 0; i < npages; i++) {
if (ap->a_reqpage != i)
vm_page_free(pages[i]);
}
+ vm_page_unlock_queues();
return VM_PAGER_ERROR;
}
size = count - uio.uio_resid;
+ vm_page_lock_queues();
for (i = 0, toff = 0; i < npages; i++, toff = nextoff) {
vm_page_t m;
nextoff = toff + PAGE_SIZE;
@@ -489,6 +492,7 @@ nwfs_getpages(ap)
}
}
}
+ vm_page_unlock_queues();
return 0;
#endif /* NWFS_RWCACHE */
}
diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c
index 6a2877b..ebb0934 100644
--- a/sys/fs/smbfs/smbfs_io.c
+++ b/sys/fs/smbfs/smbfs_io.c
@@ -455,10 +455,12 @@ smbfs_getpages(ap)
if (m->valid != 0) {
/* handled by vm_fault now */
/* vm_page_zero_invalid(m, TRUE); */
+ vm_page_lock_queues();
for (i = 0; i < npages; ++i) {
if (i != reqpage)
vm_page_free(pages[i]);
}
+ vm_page_unlock_queues();
return 0;
}
@@ -488,15 +490,18 @@ smbfs_getpages(ap)
if (error && (uio.uio_resid == count)) {
printf("smbfs_getpages: error %d\n",error);
+ vm_page_lock_queues();
for (i = 0; i < npages; i++) {
if (reqpage != i)
vm_page_free(pages[i]);
}
+ vm_page_unlock_queues();
return VM_PAGER_ERROR;
}
size = count - uio.uio_resid;
+ vm_page_lock_queues();
for (i = 0, toff = 0; i < npages; i++, toff = nextoff) {
vm_page_t m;
nextoff = toff + PAGE_SIZE;
@@ -551,6 +556,7 @@ smbfs_getpages(ap)
}
}
}
+ vm_page_unlock_queues();
return 0;
#endif /* SMBFS_RWGENERIC */
}
@@ -639,10 +645,12 @@ smbfs_putpages(ap)
if (!error) {
int nwritten = round_page(count - uio.uio_resid) / PAGE_SIZE;
+ vm_page_lock_queues();
for (i = 0; i < nwritten; i++) {
rtvals[i] = VM_PAGER_OK;
vm_page_undirty(pages[i]);
}
+ vm_page_unlock_queues();
}
return rtvals[0];
#endif /* SMBFS_RWGENERIC */
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index adc168b..29820ce 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1351,7 +1351,7 @@ _vm_page_deactivate(vm_page_t m, int athead)
{
int s;
- GIANT_REQUIRED;
+ mtx_assert(&vm_page_queue_mtx, MA_OWNED);
/*
* Ignore if already inactive.
*/
OpenPOWER on IntegriCloud