Several minor bug fixes:

* Correct (weak) segment lock assertions in lfs_fragextend and lfs_putpages.
* Keep IN_MODIFIED set if we run out of avail in lfs_putpages.
* Don't try to (re)write buffers on a VBLK vnode; fixes a panic I found
  while running with an LFS root.
* Raise priority of LFCNSEGWAIT to PVFS; PUSER is way too low for
  something the pagedaemon is relying on.
This commit is contained in:
perseant 2006-04-07 23:59:28 +00:00
parent d28248e84e
commit 7c22dcc8a6
4 changed files with 35 additions and 41 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_balloc.c,v 1.59 2005/12/24 20:45:10 perry Exp $ */
/* $NetBSD: lfs_balloc.c,v 1.60 2006/04/07 23:59:28 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.59 2005/12/24 20:45:10 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_balloc.c,v 1.60 2006/04/07 23:59:28 perseant Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -389,7 +389,7 @@ lfs_fragextend(struct vnode *vp, int osize, int nsize, daddr_t lbn, struct buf *
bb = (long)fragstofsb(fs, numfrags(fs, nsize - osize));
error = 0;
ASSERT_DUNNO_SEGLOCK(fs);
ASSERT_NO_SEGLOCK(fs);
/*
* Get the seglock so we don't enlarge blocks while a segment

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.171 2006/03/24 20:05:32 perseant Exp $ */
/* $NetBSD: lfs_segment.c,v 1.172 2006/04/07 23:59:28 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.171 2006/03/24 20:05:32 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.172 2006/04/07 23:59:28 perseant Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@ -516,6 +516,10 @@ lfs_writevnodes(struct lfs *fs, struct mount *mp, struct segment *sp, int op)
* had a chance to run.
*/
lfs_writeseg(fs, sp);
if (!VPISEMPTY(vp) &&
!WRITEINPROG(vp) &&
!(ip->i_flag & IN_ALLMOD))
LFS_SET_UINO(ip, IN_MODIFIED);
break;
}
error = 0; /* XXX not quite right */
@ -1162,6 +1166,8 @@ lfs_gather(struct lfs *fs, struct segment *sp, struct vnode *vp,
int s, count = 0;
ASSERT_SEGLOCK(fs);
if (vp->v_type == VBLK)
return 0;
KASSERT(sp->vp == NULL);
sp->vp = vp;
s = splbio();
@ -1198,17 +1204,6 @@ loop:
#endif
continue;
}
if (vp->v_type == VBLK) {
/* For block devices, just write the blocks. */
/* XXX Do we even need to do this? */
/*
* Get the block before bwrite,
* so we don't corrupt the free list
*/
bp->b_flags |= B_BUSY;
bremfree(bp);
bwrite(bp);
} else {
#ifdef DIAGNOSTIC
# ifdef LFS_USE_B_INVAL
if ((bp->b_flags & (B_CALL|B_INVAL)) == B_INVAL) {
@ -1231,7 +1226,6 @@ loop:
if (lfs_gatherblock(sp, bp, &s)) {
goto loop;
}
}
count++;
}
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.110 2006/03/19 04:10:02 rtr Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.111 2006/04/07 23:59:28 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.110 2006/03/19 04:10:02 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.111 2006/04/07 23:59:28 perseant Exp $");
#ifndef LFS
# define LFS /* for prototypes in syscallargs.h */
@ -933,9 +933,9 @@ lfs_do_segclean(struct lfs *fs, unsigned long segnum)
cip->bfree = fs->lfs_bfree;
simple_lock(&fs->lfs_interlock);
cip->avail = fs->lfs_avail - fs->lfs_ravail - fs->lfs_favail;
wakeup(&fs->lfs_avail);
simple_unlock(&fs->lfs_interlock);
(void) LFS_BWRITE_LOG(bp);
wakeup(&fs->lfs_avail);
if (lfs_dostats)
++lfs_stats.segs_reclaimed;
@ -968,7 +968,7 @@ lfs_segwait(fsid_t *fsidp, struct timeval *tv)
timeradd(tv, &time, tv);
timeout = hzto(tv);
splx(s);
error = tsleep(addr, PCATCH | PUSER, "segment", timeout);
error = tsleep(addr, PCATCH | PVFS, "segment", timeout);
return (error == ERESTART ? EINTR : 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.162 2006/04/01 00:13:01 perseant Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.163 2006/04/07 23:59:28 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.162 2006/04/01 00:13:01 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.163 2006/04/07 23:59:28 perseant Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1133,7 +1133,7 @@ lfs_flush_dirops(struct lfs *fs)
struct segment *sp;
int needunlock;
ASSERT_NO_SEGLOCK(fs);
ASSERT_MAYBE_SEGLOCK(fs);
if (fs->lfs_ronly)
return;