Module Name: src Committed By: riastradh Date: Sun Feb 23 08:40:28 UTC 2020
Modified Files: src/sys/ufs/lfs: lfs_pages.c Log Message: Don't lfs_writer_enter while holding v_interlock. There's no need to lfs_writer_enter at all here, as far as I can see. lfs_flush_fs will do it for us. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/ufs/lfs/lfs_pages.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ufs/lfs/lfs_pages.c diff -u src/sys/ufs/lfs/lfs_pages.c:1.20 src/sys/ufs/lfs/lfs_pages.c:1.21 --- src/sys/ufs/lfs/lfs_pages.c:1.20 Wed Jan 15 17:55:44 2020 +++ src/sys/ufs/lfs/lfs_pages.c Sun Feb 23 08:40:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_pages.c,v 1.20 2020/01/15 17:55:44 ad Exp $ */ +/* $NetBSD: lfs_pages.c,v 1.21 2020/02/23 08:40:27 riastradh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2019 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.20 2020/01/15 17:55:44 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.21 2020/02/23 08:40:27 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -671,29 +671,30 @@ retry: (vp->v_uflag & VU_DIROP)) { DLOG((DLOG_PAGE, "lfs_putpages: flushing VU_DIROP\n")); - lfs_writer_enter(fs, "ppdirop"); + /* + * NB: lfs_flush_fs can recursively call lfs_putpages, + * but it won't reach this branch because it passes + * PGO_LOCKED. + */ - /* Note if we hold the vnode locked */ - if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) - { - DLOG((DLOG_PAGE, "lfs_putpages: dirop inode already locked\n")); - } else { - DLOG((DLOG_PAGE, "lfs_putpages: dirop inode not locked\n")); - } mutex_exit(vp->v_interlock); - mutex_enter(&lfs_lock); lfs_flush_fs(fs, sync ? SEGM_SYNC : 0); mutex_exit(&lfs_lock); - mutex_enter(vp->v_interlock); - lfs_writer_leave(fs); /* * The flush will have cleaned out this vnode as well, * no need to do more to it. * XXX then why are we falling through and continuing? */ + + /* + * XXX State may have changed while we dropped the + * lock; start over just in case. The above comment + * suggests this should maybe instead be goto out. + */ + goto retry; } /*