summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2014-04-15 07:50:18 +0000
committerscottl <scottl@FreeBSD.org>2014-04-15 07:50:18 +0000
commitc804ca5e7864982aa741bb5f6db7f746bf826790 (patch)
treec41d074b72a0ce9853d57d15a169a65db18198ce /sys/ufs
parented992167df244f0cf3b39a2e3401758592b630dd (diff)
downloadFreeBSD-src-c804ca5e7864982aa741bb5f6db7f746bf826790.zip
FreeBSD-src-c804ca5e7864982aa741bb5f6db7f746bf826790.tar.gz
MFC r262812
- Gracefully handle truncation failures when trying to shrink directories. This could cause dirhash panics since the dirhash state would be successfully truncated while the directory was not. Submitted by: jeffr
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_lookup.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index 7068565..87a030e 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -1130,12 +1130,15 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp, isrename)
dp->i_endoff && dp->i_endoff < dp->i_size) {
if (tvp != NULL)
VOP_UNLOCK(tvp, 0);
+ error = UFS_TRUNCATE(dvp, (off_t)dp->i_endoff,
+ IO_NORMAL | IO_SYNC, cr);
+ if (error != 0)
+ vprint("ufs_direnter: failted to truncate", dvp);
#ifdef UFS_DIRHASH
- if (dp->i_dirhash != NULL)
+ if (error == 0 && dp->i_dirhash != NULL)
ufsdirhash_dirtrunc(dp, dp->i_endoff);
#endif
- (void) UFS_TRUNCATE(dvp, (off_t)dp->i_endoff,
- IO_NORMAL | IO_SYNC, cr);
+ error = 0;
if (tvp != NULL)
vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY);
}
OpenPOWER on IntegriCloud