diff options
author | mckusick <mckusick@FreeBSD.org> | 2002-10-23 21:47:02 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2002-10-23 21:47:02 +0000 |
commit | 0337df10b74dd2a5fda0bcae34718d73c8781e1b (patch) | |
tree | 793292f1def35da471e64cb1bbfe6c585d3aab68 /sys/ufs | |
parent | 0843e3b4183094a5ac0d797602369fb72da6f8b6 (diff) | |
download | FreeBSD-src-0337df10b74dd2a5fda0bcae34718d73c8781e1b.zip FreeBSD-src-0337df10b74dd2a5fda0bcae34718d73c8781e1b.tar.gz |
We must be careful to avoid recursive copy-on-write faults when
trying to clean up during disk-full senarios.
Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8cbf3d8..422cabc 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -685,6 +685,13 @@ process_worklist_item(matchmnt, flags) struct vnode *vp; int matchcnt = 0; + /* + * If we are being called because of a process doing a + * copy-on-write, then it is not safe to write as we may + * recurse into the copy-on-write routine. + */ + if (curthread->td_proc->p_flag & P_COWINPROGRESS) + return (-1); ACQUIRE_LOCK(&lk); /* * Normally we just process each item on the worklist in order. @@ -5427,7 +5434,13 @@ softdep_request_cleanup(fs, vp) needed = fs->fs_cstotal.cs_nbfree + fs->fs_contigsumsize; starttime = time_second + tickdelay; - if (UFS_UPDATE(vp, 1) != 0) + /* + * If we are being called because of a process doing a + * copy-on-write, then it is not safe to update the vnode + * as we may recurse into the copy-on-write routine. + */ + if ((curthread->td_proc->p_flag & P_COWINPROGRESS) == 0 && + UFS_UPDATE(vp, 1) != 0) return (0); while (fs->fs_pendingblocks > 0 && fs->fs_cstotal.cs_nbfree <= needed) { if (time_second > starttime) |