Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/sys/uvm Pullup 1.39 [chs]:



details:   https://anonhg.NetBSD.org/src/rev/b9c85745a67c
branches:  netbsd-1-5
changeset: 490214:b9c85745a67c
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Nov 13 20:55:38 2000 +0000

description:
Pullup 1.39 [chs]:
in swap_off(), reverse the order of vrele() and VOP_CLOSE() so that
devices will actually be notified if this is the last close.
this allows raidframe swap devices to be marked clean.
also, move the corresponding vref() into swap_on() for symmetry
and improve some comments.

diffstat:

 sys/uvm/uvm_swap.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (68 lines):

diff -r ec30c856361e -r b9c85745a67c sys/uvm/uvm_swap.c
--- a/sys/uvm/uvm_swap.c        Mon Nov 13 20:50:49 2000 +0000
+++ b/sys/uvm/uvm_swap.c        Mon Nov 13 20:55:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_swap.c,v 1.37 2000/05/19 03:45:04 thorpej Exp $    */
+/*     $NetBSD: uvm_swap.c,v 1.37.4.1 2000/11/13 20:55:38 tv Exp $     */
 
 /*
  * Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -730,12 +730,6 @@
                        free(sdp, M_VMSWAP);
                        break;
                }
-
-               /*
-                * got it!   now add a second reference to vp so that
-                * we keep a reference to the vnode after we return.
-                */
-               vref(vp);
                break;
 
        case SWAP_OFF:
@@ -769,9 +763,10 @@
        }
 
        /*
-        * done!   use vput to drop our reference and unlock
+        * done!  release the ref gained by namei() and unlock.
         */
        vput(vp);
+
 out:
        lockmgr(&swap_syscall_lock, LK_RELEASE, NULL);
 
@@ -953,6 +948,11 @@
                printf("leaving %d pages of swap\n", size);
        }
 
+       /*
+        * add a ref to vp to reflect usage as a swap device.
+        */
+       vref(vp);
+
        /*
         * add anons to reflect the new swap space
         */
@@ -1023,17 +1023,17 @@
 #endif
 
        /*
-        * done with the vnode.
+        * done with the vnode and saved creds.
+        * drop our ref on the vnode before calling VOP_CLOSE()
+        * so that spec_close() can tell if this is the last close.
         */
        if (sdp->swd_vp->v_type == VREG) {
                crfree(sdp->swd_cred);
        }
+       vrele(sdp->swd_vp);
        if (sdp->swd_vp != rootvp) {
                (void) VOP_CLOSE(sdp->swd_vp, FREAD|FWRITE, p->p_ucred, p);
        }
-       if (sdp->swd_vp) {
-               vrele(sdp->swd_vp);
-       }
 
        /* remove anons from the system */
        uvm_anon_remove(sdp->swd_npages);



Home | Main Index | Thread Index | Old Index