diff options
author | peter <peter@FreeBSD.org> | 1998-05-13 06:10:13 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-05-13 06:10:13 +0000 |
commit | 6613440b5873a83df792dc9cc4363e49d818da94 (patch) | |
tree | 8e6fe084fe9aa617daa32795501de39bab8dd0f2 /sys/nfsclient | |
parent | 25a20d1f0ecf2720546055620a7008d96a011e50 (diff) | |
download | FreeBSD-src-6613440b5873a83df792dc9cc4363e49d818da94.zip FreeBSD-src-6613440b5873a83df792dc9cc4363e49d818da94.tar.gz |
Hold a reference to the vnode during the sillyrename cleanup. If we block
in nfs_vinvalbuf() or the nfs_removeit(), we can have the nfsnode reallocated
from underneath us (eg: replaced by a ufs 'struct inode') which can cause
disk corruption ('freeing free block' when di_db[5] gets trashed).
This is not a cheap fix, but it'll do until the nfsnodes get reference
counting and/or locking.
Apparently NetBSD have a similar fix (apparently from BSDI).
I wish all PR's had this much useful detail. :-)
PR: 6611
Submitted by: Stephen Clawson <sclawson@marker.cs.utah.edu>
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_node.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index 48d0baf..ee145ce 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_node.c 8.6 (Berkeley) 5/22/95 - * $Id: nfs_node.c,v 1.23 1997/12/27 02:56:33 bde Exp $ + * $Id: nfs_node.c,v 1.24 1998/02/09 06:10:33 eivind Exp $ */ @@ -208,6 +208,13 @@ nfs_inactive(ap) sp = (struct sillyrename *)0; if (sp) { /* + * XXX We need a reference to keep the vnode from being + * recycled by getnewvnode while we do the I/O + * associated with discarding the buffers. + */ + if (vget(ap->a_vp, 0)) + panic("nfs_inactive: lost vnode"); + /* * Remove the silly file that was rename'd earlier */ (void) nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, p, 1); @@ -215,6 +222,7 @@ nfs_inactive(ap) crfree(sp->s_cred); vrele(sp->s_dvp); FREE((caddr_t)sp, M_NFSREQ); + vrele(ap->a_vp); /* XXX Undo above reference */ } np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT | NQNFSEVICTED | NQNFSNONCACHE | NQNFSWRITE); |