Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm PR kern/54759 (vm.ubc_direct deadlock when read()/wr...
details: https://anonhg.NetBSD.org/src/rev/d340c904f42a
branches: trunk
changeset: 971429:d340c904f42a
user: ad <ad%NetBSD.org@localhost>
date: Thu Apr 23 21:47:07 2020 +0000
description:
PR kern/54759 (vm.ubc_direct deadlock when read()/write() into mapping of itself)
- Add new flag UBC_ISMAPPED which tells ubc_uiomove() the object is mmap()ed
somewhere. Use it to decide whether to do direct-mapped copy, rather than
poking around directly in the vnode in ubc_uiomove(), which is ugly and
doesn't work for tmpfs. It would be nicer to contain all this in UVM but
the filesystem provides the needed locking here (VV_MAPPED) and to
reinvent that would suck more.
- Rename UBC_UNMAP_FLAG() to UBC_VNODE_FLAGS(). Pass in UBC_ISMAPPED where
appropriate.
diffstat:
sys/fs/adosfs/advnops.c | 6 +++---
sys/fs/cd9660/cd9660_vnops.c | 6 +++---
sys/fs/efs/efs_vnops.c | 6 +++---
sys/fs/filecorefs/filecore_vnops.c | 6 +++---
sys/fs/hfs/hfs_vnops.c | 6 +++---
sys/fs/msdosfs/msdosfs_denode.c | 8 ++++----
sys/fs/msdosfs/msdosfs_vnops.c | 10 +++++-----
sys/fs/nilfs/nilfs_vnops.c | 8 ++++----
sys/fs/puffs/puffs_vnops.c | 10 +++++-----
sys/fs/sysvbfs/sysvbfs_vnops.c | 8 ++++----
sys/fs/tmpfs/tmpfs_subr.c | 6 +++---
sys/fs/tmpfs/tmpfs_vnops.c | 8 ++++----
sys/fs/udf/udf_allocation.c | 10 +++++-----
sys/fs/udf/udf_vnops.c | 8 ++++----
sys/fs/v7fs/v7fs_vnops.c | 8 ++++----
sys/nfs/nfs_bio.c | 8 ++++----
sys/rump/librump/rumpvfs/rumpfs.c | 8 ++++----
sys/ufs/chfs/chfs_subr.c | 4 ++--
sys/ufs/chfs/chfs_vnops.c | 7 +++----
sys/ufs/ext2fs/ext2fs_inode.c | 6 +++---
sys/ufs/ext2fs/ext2fs_readwrite.c | 8 ++++----
sys/ufs/ffs/ffs_inode.c | 6 +++---
sys/ufs/lfs/lfs_inode.c | 6 +++---
sys/ufs/lfs/ulfs_readwrite.c | 8 ++++----
sys/ufs/ufs/ufs_readwrite.c | 8 ++++----
sys/uvm/uvm_bio.c | 32 ++++++++++++--------------------
sys/uvm/uvm_extern.h | 11 +++++++----
27 files changed, 110 insertions(+), 116 deletions(-)
diffs (truncated from 908 to 300 lines):
diff -r e8e93505677d -r d340c904f42a sys/fs/adosfs/advnops.c
--- a/sys/fs/adosfs/advnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/adosfs/advnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: advnops.c,v 1.52 2020/04/23 09:58:37 jdolecek Exp $ */
+/* $NetBSD: advnops.c,v 1.53 2020/04/23 21:47:07 ad Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.52 2020/04/23 09:58:37 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.53 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -270,7 +270,7 @@
break;
}
error = ubc_uiomove(&vp->v_uobj, uio, bytelen, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
if (error) {
break;
}
diff -r e8e93505677d -r d340c904f42a sys/fs/cd9660/cd9660_vnops.c
--- a/sys/fs/cd9660/cd9660_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/cd9660/cd9660_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd9660_vnops.c,v 1.55 2019/07/12 17:18:30 maxv Exp $ */
+/* $NetBSD: cd9660_vnops.c,v 1.56 2020/04/23 21:47:07 ad Exp $ */
/*-
* Copyright (c) 1994
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.55 2019/07/12 17:18:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.56 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -241,7 +241,7 @@
if (bytelen == 0)
break;
error = ubc_uiomove(&vp->v_uobj, uio, bytelen, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
if (error)
break;
}
diff -r e8e93505677d -r d340c904f42a sys/fs/efs/efs_vnops.c
--- a/sys/fs/efs/efs_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/efs/efs_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efs_vnops.c,v 1.38 2017/05/26 14:21:00 riastradh Exp $ */
+/* $NetBSD: efs_vnops.c,v 1.39 2020/04/23 21:47:07 ad Exp $ */
/*
* Copyright (c) 2006 Stephen M. Rumble <rumble%ephemeral.org@localhost>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.38 2017/05/26 14:21:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.39 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -278,7 +278,7 @@
len = MIN(len, eip->ei_size - uio->uio_offset);
err = ubc_uiomove(&ap->a_vp->v_uobj, uio, len, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(ap->a_vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(ap->a_vp));
if (err) {
EFS_DPRINTF(("efs_read: uiomove error %d\n",
err));
diff -r e8e93505677d -r d340c904f42a sys/fs/filecorefs/filecore_vnops.c
--- a/sys/fs/filecorefs/filecore_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/filecorefs/filecore_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filecore_vnops.c,v 1.44 2015/04/20 23:03:08 riastradh Exp $ */
+/* $NetBSD: filecore_vnops.c,v 1.45 2020/04/23 21:47:07 ad Exp $ */
/*-
* Copyright (c) 1994 The Regents of the University of California.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.44 2015/04/20 23:03:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filecore_vnops.c,v 1.45 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -230,7 +230,7 @@
break;
}
error = ubc_uiomove(&vp->v_uobj, uio, bytelen, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
if (error) {
break;
}
diff -r e8e93505677d -r d340c904f42a sys/fs/hfs/hfs_vnops.c
--- a/sys/fs/hfs/hfs_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/hfs/hfs_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hfs_vnops.c,v 1.34 2017/05/26 14:21:00 riastradh Exp $ */
+/* $NetBSD: hfs_vnops.c,v 1.35 2020/04/23 21:47:07 ad Exp $ */
/*-
* Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.34 2017/05/26 14:21:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.35 2020/04/23 21:47:07 ad Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@@ -852,7 +852,7 @@
break;
error = ubc_uiomove(&vp->v_uobj, uio, len, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
}
return error;
diff -r e8e93505677d -r d340c904f42a sys/fs/msdosfs/msdosfs_denode.c
--- a/sys/fs/msdosfs/msdosfs_denode.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/msdosfs/msdosfs_denode.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_denode.c,v 1.58 2020/04/13 19:23:17 ad Exp $ */
+/* $NetBSD: msdosfs_denode.c,v 1.59 2020/04/23 21:47:07 ad Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.58 2020/04/13 19:23:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.59 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -425,7 +425,7 @@
} else {
ubc_zerorange(&DETOV(dep)->v_uobj, length,
pmp->pm_bpcluster - boff,
- UBC_UNMAP_FLAG(DETOV(dep)));
+ UBC_VNODE_FLAGS(DETOV(dep)));
}
}
@@ -523,7 +523,7 @@
dep->de_flag |= DE_UPDATE|DE_MODIFIED;
ubc_zerorange(&DETOV(dep)->v_uobj, (off_t)osize,
(size_t)(round_page(dep->de_FileSize) - osize),
- UBC_UNMAP_FLAG(DETOV(dep)));
+ UBC_VNODE_FLAGS(DETOV(dep)));
uvm_vnp_setsize(DETOV(dep), (voff_t)dep->de_FileSize);
return (deupdat(dep, 1));
}
diff -r e8e93505677d -r d340c904f42a sys/fs/msdosfs/msdosfs_vnops.c
--- a/sys/fs/msdosfs/msdosfs_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/msdosfs/msdosfs_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msdosfs_vnops.c,v 1.101 2020/04/13 19:23:17 ad Exp $ */
+/* $NetBSD: msdosfs_vnops.c,v 1.102 2020/04/23 21:47:07 ad Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.101 2020/04/13 19:23:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.102 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -480,7 +480,7 @@
if (bytelen == 0)
break;
error = ubc_uiomove(&vp->v_uobj, uio, bytelen, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
if (error)
break;
}
@@ -624,7 +624,7 @@
rem = round_page(dep->de_FileSize) - dep->de_FileSize;
if (rem > 0)
ubc_zerorange(&vp->v_uobj, (off_t)dep->de_FileSize,
- rem, UBC_UNMAP_FLAG(vp));
+ rem, UBC_VNODE_FLAGS(vp));
extended = 1;
}
@@ -633,7 +633,7 @@
bytelen = uio->uio_resid;
error = ubc_uiomove(&vp->v_uobj, uio, bytelen,
- IO_ADV_DECODE(ioflag), UBC_WRITE | UBC_UNMAP_FLAG(vp));
+ IO_ADV_DECODE(ioflag), UBC_WRITE | UBC_VNODE_FLAGS(vp));
if (error)
break;
diff -r e8e93505677d -r d340c904f42a sys/fs/nilfs/nilfs_vnops.c
--- a/sys/fs/nilfs/nilfs_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/nilfs/nilfs_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nilfs_vnops.c,v 1.39 2020/04/13 19:23:18 ad Exp $ */
+/* $NetBSD: nilfs_vnops.c,v 1.40 2020/04/23 21:47:07 ad Exp $ */
/*
* Copyright (c) 2008, 2009 Reinoud Zandijk
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.39 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nilfs_vnops.c,v 1.40 2020/04/23 21:47:07 ad Exp $");
#endif /* not lint */
@@ -179,7 +179,7 @@
/* ubc, here we come, prepare to trap */
error = ubc_uiomove(uobj, uio, len, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
if (error)
break;
}
@@ -269,7 +269,7 @@
/* ubc, here we come, prepare to trap */
error = ubc_uiomove(uobj, uio, len, advice,
- UBC_WRITE | UBC_UNMAP_FLAG(vp));
+ UBC_WRITE | UBC_VNODE_FLAGS(vp));
if (error)
break;
}
diff -r e8e93505677d -r d340c904f42a sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/puffs/puffs_vnops.c Thu Apr 23 21:47:07 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_vnops.c,v 1.214 2020/02/23 15:46:40 ad Exp $ */
+/* $NetBSD: puffs_vnops.c,v 1.215 2020/04/23 21:47:07 ad Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.214 2020/02/23 15:46:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.215 2020/04/23 21:47:07 ad Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -1158,7 +1158,7 @@
return;
vsize_t len = round_page(off) - off;
- ubc_zerorange(&vp->v_uobj, off, len, UBC_WRITE|UBC_UNMAP_FLAG(vp));
+ ubc_zerorange(&vp->v_uobj, off, len, UBC_WRITE|UBC_VNODE_FLAGS(vp));
}
static int
@@ -2297,7 +2297,7 @@
break;
error = ubc_uiomove(&vp->v_uobj, uio, bytelen, advice,
- UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+ UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
if (error)
break;
}
@@ -2407,7 +2407,7 @@
if (vp->v_type == VREG &&
PUFFS_USE_PAGECACHE(pmp) &&
!(pn->pn_stat & PNODE_WDIRECT)) {
- ubcflags = UBC_WRITE | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp);
+ ubcflags = UBC_WRITE | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp);
while (uio->uio_resid > 0) {
oldoff = uio->uio_offset;
diff -r e8e93505677d -r d340c904f42a sys/fs/sysvbfs/sysvbfs_vnops.c
--- a/sys/fs/sysvbfs/sysvbfs_vnops.c Thu Apr 23 21:35:18 2020 +0000
+++ b/sys/fs/sysvbfs/sysvbfs_vnops.c Thu Apr 23 21:47:07 2020 +0000
Home |
Main Index |
Thread Index |
Old Index