From 44ee8e221156e7d2f2a088fdea3361cdc9902479 Mon Sep 17 00:00:00 2001 From: alc Date: Sat, 4 Oct 2003 23:37:38 +0000 Subject: Synchronize access to a vm page's valid field using the containing vm object's lock. --- sys/fs/nwfs/nwfs_io.c | 6 ++---- sys/fs/smbfs/smbfs_io.c | 9 ++++----- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'sys/fs') diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index a64b844..d0ab8e5 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -440,8 +440,7 @@ nwfs_getpages(ap) relpbuf(bp, &nwfs_pbuf_freecnt); - if (error) - VM_OBJECT_LOCK(object); + VM_OBJECT_LOCK(object); if (error && (uio.uio_resid == count)) { printf("nwfs_getpages: error %d\n",error); vm_page_lock_queues(); @@ -497,8 +496,7 @@ nwfs_getpages(ap) } } vm_page_unlock_queues(); - if (error) - VM_OBJECT_UNLOCK(object); + VM_OBJECT_UNLOCK(object); return 0; #endif /* NWFS_RWCACHE */ } diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index eed3789..99f7c7d 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -453,10 +453,10 @@ smbfs_getpages(ap) */ m = pages[reqpage]; + VM_OBJECT_LOCK(object); if (m->valid != 0) { /* handled by vm_fault now */ /* vm_page_zero_invalid(m, TRUE); */ - VM_OBJECT_LOCK(object); vm_page_lock_queues(); for (i = 0; i < npages; ++i) { if (i != reqpage) @@ -466,6 +466,7 @@ smbfs_getpages(ap) VM_OBJECT_UNLOCK(object); return 0; } + VM_OBJECT_UNLOCK(object); smb_makescred(&scred, td, cred); @@ -491,8 +492,7 @@ smbfs_getpages(ap) relpbuf(bp, &smbfs_pbuf_freecnt); - if (error) - VM_OBJECT_LOCK(object); + VM_OBJECT_LOCK(object); if (error && (uio.uio_resid == count)) { printf("smbfs_getpages: error %d\n",error); vm_page_lock_queues(); @@ -563,8 +563,7 @@ smbfs_getpages(ap) } } vm_page_unlock_queues(); - if (error) - VM_OBJECT_UNLOCK(object); + VM_OBJECT_UNLOCK(object); return 0; #endif /* SMBFS_RWGENERIC */ } -- cgit v1.1