In sfs_reclaim, there's code to detect that the refcount has gone up
again (past 1), and return instead of actually reclaiming the vnode.
At this point it is necessary to reduce the refcount by one,
atomically with the check, to actually drop the reference associated
with the call to reclaim. (Due to oversight, the code in vnode_decref
doesn't do this, and due to synchronization issues, you don't want to
try to change it so it does.)
Since the sfs code provided should have done this, it's kind of our
fault, and we'll proceed accordingly if you've already submitted a
tree that suffers from this problem.
This is the change that would apply to the base system:
Index: src/kern/fs/sfs/sfs_vnode.c
===================================================================
RCS file: /disk/disk0/cs161/CVSREPO/os161/src/kern/fs/sfs/sfs_vnode.c,v
retrieving revision 1.24
diff -u -r1.24 sfs_vnode.c
--- kern/fs/sfs/sfs_vnode.c 4 Sep 2002 01:42:06 -0000 1.24
+++ kern/fs/sfs/sfs_vnode.c 22 Apr 2003 00:18:56 -0000
@@ -868,6 +868,11 @@
*/
lock_acquire(v->vn_countlock);
if (v->vn_refcount != 1) {
+
+ /* consume the reference VOP_DECREF gave us */
+ assert(v->vn_refcount>1);
+ v->vn_refcount--;
+
lock_release(v->vn_countlock);
return EBUSY;
}
--
- David A. Holland / dholland(a)eecs.harvard.edu
Show replies by date