summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-12-07 21:12:22 +0000
committertedu <tedu@openbsd.org>2014-12-07 21:12:22 +0000
commit65618486172fcc31c84d3b6336ca1b34f43f9eaf (patch)
treef199722dca9253385d1306dc1932f91dcf0690fa
parentDon't make manpages from anything in Pod-Perldoc/corpus (diff)
downloadwireguard-openbsd-65618486172fcc31c84d3b6336ca1b34f43f9eaf.tar.xz
wireguard-openbsd-65618486172fcc31c84d3b6336ca1b34f43f9eaf.zip
don't truncate the dirhash if ufs truncate fails.
adapted from a freebsd commit by david hill
-rw-r--r--sys/ufs/ufs/ufs_lookup.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index f1095937234..d2386eed77c 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_lookup.c,v 1.45 2014/07/08 17:19:26 deraadt Exp $ */
+/* $OpenBSD: ufs_lookup.c,v 1.46 2014/12/07 21:12:22 tedu Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.7 1996/02/09 22:36:06 christos Exp $ */
/*
@@ -918,14 +918,11 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
if (error == 0 && dp->i_endoff && dp->i_endoff < DIP(dp, size)) {
if (tvp != NULL)
VOP_UNLOCK(tvp, 0, p);
+ error = UFS_TRUNCATE(dp, (off_t)dp->i_endoff, IO_SYNC, cr);
#ifdef UFS_DIRHASH
- if (dp->i_dirhash != NULL)
+ if (error == 0 && dp->i_dirhash != NULL)
ufsdirhash_dirtrunc(dp, dp->i_endoff);
#endif
-
-
- error = UFS_TRUNCATE(dp, (off_t)dp->i_endoff, IO_SYNC, cr);
-
if (tvp != NULL)
vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, p);
}