ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there
Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
74a3652f83
commit
038fe6e089
@ -1676,38 +1676,16 @@ ufs_rename(ap)
|
|||||||
|
|
||||||
vput(fdvp);
|
vput(fdvp);
|
||||||
vput(fvp);
|
vput(fvp);
|
||||||
if (tvp)
|
|
||||||
vput(tvp);
|
|
||||||
/*
|
/*
|
||||||
* If compaction or fsync was requested do it now that other locks
|
* If compaction or fsync was requested do it in
|
||||||
* are no longer needed.
|
* ffs_vput_pair() now that other locks are no longer needed.
|
||||||
*/
|
*/
|
||||||
if (error == 0 && endoff != 0) {
|
if (error == 0 && endoff != 0) {
|
||||||
do {
|
UFS_INODE_SET_FLAG(tdp, IN_ENDOFF);
|
||||||
error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL |
|
SET_I_ENDOFF(tdp, endoff);
|
||||||
(DOINGASYNC(tdvp) ? 0 : IO_SYNC), tcnp->cn_cred);
|
|
||||||
} while (error == ERELOOKUP);
|
|
||||||
if (error != 0 && !ffs_fsfail_cleanup(VFSTOUFS(mp), error))
|
|
||||||
vn_printf(tdvp,
|
|
||||||
"ufs_rename: failed to truncate, error %d\n",
|
|
||||||
error);
|
|
||||||
#ifdef UFS_DIRHASH
|
|
||||||
if (error != 0)
|
|
||||||
ufsdirhash_free(tdp);
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* 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) {
|
VOP_VPUT_PAIR(tdvp, &tvp, true);
|
||||||
do {
|
|
||||||
error = VOP_FSYNC(tdvp, MNT_WAIT, td);
|
|
||||||
} while (error == ERELOOKUP);
|
|
||||||
}
|
|
||||||
vput(tdvp);
|
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
|
Loading…
Reference in New Issue
Block a user