Change references to SEGM_W_DIROPS to SEGM_CKP, and replace the logic that

formerly used SEGM_W_DIROPS in lfs_segwrite() appropriately.  This prevents
a problem in which processes could get stuck in "buffers" sleep forever.
This commit is contained in:
perseant 2007-05-16 19:11:37 +00:00
parent 2f67db7ec7
commit 9234ba6fd8
5 changed files with 16 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs.h,v 1.119 2007/04/17 01:16:46 perseant Exp $ */
/* $NetBSD: lfs.h,v 1.120 2007/05/16 19:11:37 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -966,7 +966,6 @@ struct segment {
#define SEGM_PAGEDAEMON 0x10 /* pagedaemon called us */
#define SEGM_WRITERD 0x20 /* LFS writed called us */
#define SEGM_FORCE_CKP 0x40 /* Force checkpoint right away */
#define SEGM_W_DIROPS 0x80 /* Write dirops in generic segwrite */
u_int16_t seg_flags; /* run-time flags for this segment */
u_int32_t seg_iocount; /* number of ios pending */
int ndupino; /* number of duplicate inodes */

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_bio.c,v 1.100 2007/04/18 00:50:06 perseant Exp $ */
/* $NetBSD: lfs_bio.c,v 1.101 2007/05/16 19:11:37 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_bio.c,v 1.100 2007/04/18 00:50:06 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_bio.c,v 1.101 2007/05/16 19:11:37 perseant Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -689,7 +689,7 @@ lfs_check(struct vnode *vp, daddr_t blkno, int flags)
/* If there are too many pending dirops, we have to flush them. */
if (fs->lfs_dirvcount > LFS_MAX_FSDIROP(fs) ||
lfs_dirvcount > LFS_MAX_DIROP || fs->lfs_diropwait > 0) {
flags |= SEGM_W_DIROPS;
flags |= SEGM_CKP;
}
if (locked_queue_count + INOCOUNT(fs) > LFS_MAX_BUFS ||

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_inode.c,v 1.108 2007/04/18 00:49:33 perseant Exp $ */
/* $NetBSD: lfs_inode.c,v 1.109 2007/05/16 19:11:37 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_inode.c,v 1.108 2007/04/18 00:49:33 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.109 2007/05/16 19:11:37 perseant Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -179,7 +179,7 @@ lfs_update(struct vnode *vp, const struct timespec *acc,
DLOG((DLOG_DIROP, "lfs_update: vflags 0x%x, iflags"
" 0x%x\n", vp->v_flag, ip->i_flag));
if (fs->lfs_dirops == 0)
lfs_flush_fs(fs, SEGM_SYNC | SEGM_W_DIROPS);
lfs_flush_fs(fs, SEGM_SYNC);
else
ltsleep(&fs->lfs_writer, PRIBIO+1, "lfs_fsync",
0, &fs->lfs_interlock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.199 2007/04/17 01:16:46 perseant Exp $ */
/* $NetBSD: lfs_segment.c,v 1.200 2007/05/16 19:11:38 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.199 2007/04/17 01:16:46 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.200 2007/05/16 19:11:38 perseant Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@ -647,8 +647,8 @@ lfs_segwrite(struct mount *mp, int flags)
else if (!(sp->seg_flags & SEGM_FORCE_CKP)) {
do {
um_error = lfs_writevnodes(fs, mp, sp, VN_REG);
if (do_ckp ||
(sp->seg_flags & SEGM_W_DIROPS && !fs->lfs_dirops)) {
if (do_ckp || fs->lfs_dirops == 0) {
if (!writer_set) {
lfs_writer_enter(fs, "lfs writer");
writer_set = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.234 2007/04/17 01:16:46 perseant Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.235 2007/05/16 19:11:38 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.234 2007/04/17 01:16:46 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.235 2007/05/16 19:11:38 perseant Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -230,7 +230,7 @@ lfs_writerd(void *arg)
if ((fs->lfs_dirvcount > LFS_MAX_FSDIROP(fs) ||
lfs_dirvcount > LFS_MAX_DIROP) &&
fs->lfs_dirops == 0)
fsflags |= SEGM_W_DIROPS;
fsflags |= SEGM_CKP;
if (fs->lfs_pdflush) {
DLOG((DLOG_FLUSH, "lfs_writerd: pdflush set\n"));
fs->lfs_pdflush = 0;
@ -910,8 +910,8 @@ lfs_unmount(struct mount *mp, int mntflags, struct lwp *l)
fs = ump->um_lfs;
/* Two checkpoints */
lfs_segwrite(mp, SEGM_CKP | SEGM_SYNC | SEGM_W_DIROPS);
lfs_segwrite(mp, SEGM_CKP | SEGM_SYNC | SEGM_W_DIROPS);
lfs_segwrite(mp, SEGM_CKP | SEGM_SYNC);
lfs_segwrite(mp, SEGM_CKP | SEGM_SYNC);
/* wake up the cleaner so it can die */
lfs_wakeup_cleaner(fs);