From aeb7e802ecb7efc37e344c0fa9324f8092e79c77 Mon Sep 17 00:00:00 2001 From: pooka Date: Wed, 25 Aug 2010 13:51:50 +0000 Subject: [PATCH] I'm not even going to describe this change. I'll just say that churn creates interesting code. Fixes open(O_CREAT|O_TRUNC) on at least tmpfs and nfs to not fail with ENOENT due to a racy removal of the newly created file. Caught, as most bugs these days are, by a test run. --- sys/kern/vfs_vnops.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 1c93be4ebef9..f8ddc24d8efe 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.176 2010/07/28 09:30:21 hannken Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.177 2010/08/25 13:51:50 pooka Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.176 2010/07/28 09:30:21 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.177 2010/08/25 13:51:50 pooka Exp $"); #include "veriexec.h" @@ -215,9 +215,6 @@ vn_open(struct nameidata *ndp, int fmode, int cmode) } if (fmode & O_TRUNC) { - VOP_UNLOCK(vp); /* XXX */ - - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* XXX */ vattr_null(&va); va.va_size = 0; error = VOP_SETATTR(vp, &va, cred);