Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/lfs It isn't safe to drain dirops with seglock held, ...
details: https://anonhg.NetBSD.org/src/rev/50bcb266ec87
branches: trunk
changeset: 354406:50bcb266ec87
user: maya <maya%NetBSD.org@localhost>
date: Thu Jun 15 14:37:30 2017 +0000
description:
It isn't safe to drain dirops with seglock held, it'll deadlock if there
are any dirops. drain before grabbing seglock.
lfs_dirops == 0 is always true (as we already drained dirops), so omit
that part of the comparison.
Fixes a lot of LFS deadlocks. PR kern/52301
Many thanks to dholland for help analyzing coredumps
diffstat:
sys/ufs/lfs/lfs_segment.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diffs (58 lines):
diff -r e934e7ee06d2 -r 50bcb266ec87 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Thu Jun 15 14:23:42 2017 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Thu Jun 15 14:37:30 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $ */
+/* $NetBSD: lfs_segment.c,v 1.272 2017/06/15 14:37:30 maya Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.272 2017/06/15 14:37:30 maya Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@@ -603,7 +603,6 @@
SEGUSE *segusep;
int do_ckp, did_ckp, error;
unsigned n, segleft, maxseg, sn, i, curseg;
- int writer_set = 0;
int dirty;
int redo;
SEGSUM *ssp;
@@ -628,6 +627,8 @@
if (do_ckp)
flags &= ~SEGM_SINGLE;
+ lfs_writer_enter(fs, "lfs segwrite");
+
lfs_seglock(fs, flags | (do_ckp ? SEGM_CKP : 0));
sp = fs->lfs_sp;
if (sp->seg_flags & (SEGM_CLEAN | SEGM_CKP))
@@ -653,11 +654,7 @@
break;
}
- if (do_ckp || fs->lfs_dirops == 0) {
- if (!writer_set) {
- lfs_writer_enter(fs, "lfs writer");
- writer_set = 1;
- }
+ if (do_ckp) {
error = lfs_writevnodes(fs, mp, sp, VN_DIROP);
if (um_error == 0)
um_error = error;
@@ -806,8 +803,7 @@
/* Note Ifile no longer needs to be written */
fs->lfs_doifile = 0;
- if (writer_set)
- lfs_writer_leave(fs);
+ lfs_writer_leave(fs);
/*
* If we didn't write the Ifile, we didn't really do anything.
Home |
Main Index |
Thread Index |
Old Index