diff options
author | kib <kib@FreeBSD.org> | 2016-09-22 09:14:04 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-09-22 09:14:04 +0000 |
commit | 65eee2e6f94289d9f4d416f06c304a714747b721 (patch) | |
tree | 780f5471e50b2e977c3b54211cf458d49354db8d /sys/ufs/ufs | |
parent | 3753da0e33684f442867c5841ecd869e2677d06d (diff) | |
download | FreeBSD-src-65eee2e6f94289d9f4d416f06c304a714747b721.zip FreeBSD-src-65eee2e6f94289d9f4d416f06c304a714747b721.tar.gz |
MFC r305601:
On rename, do not perform truncation of dirhash if the vnode truncation failed.
Diffstat (limited to 'sys/ufs/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 217ca90..07e59aa 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1529,11 +1529,21 @@ unlockout: * are no longer needed. */ if (error == 0 && endoff != 0) { + error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | IO_SYNC, + tcnp->cn_cred); + if (error != 0) + vn_printf(tdvp, "ufs_rename: failed to truncate " + "err %d", error); #ifdef UFS_DIRHASH - if (tdp->i_dirhash != NULL) + else if (tdp->i_dirhash != NULL) ufsdirhash_dirtrunc(tdp, endoff); #endif - UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | IO_SYNC, tcnp->cn_cred); + /* + * Even if the directory compaction failed, rename was + * succesful. Do not propagate a UFS_TRUNCATE() error + * to the caller. + */ + error = 0; } if (error == 0 && tdp->i_flag & IN_NEEDSYNC) error = VOP_FSYNC(tdvp, MNT_WAIT, td); |