ufs_rename(): revert the bump of fvp nlink count in case of EMLINK for tdvp

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2022-07-04 13:28:49 +03:00
parent ab5ef5fb63
commit 513e1bbc73

View File

@ -1576,17 +1576,17 @@ ufs_rename(ap)
* .. is rewritten below.
*/
if (tdp->i_nlink >= UFS_LINK_MAX) {
if (!DOINGSOFTDEP(tdvp) ||
tdp->i_effnlink >= UFS_LINK_MAX) {
error = EMLINK;
goto unlockout;
}
fip->i_effnlink--;
fip->i_nlink--;
DIP_SET(fip, i_nlink, fip->i_nlink);
UFS_INODE_SET_FLAG(fip, IN_CHANGE);
if (DOINGSOFTDEP(fvp))
softdep_revert_link(tdp, fip);
if (!DOINGSOFTDEP(tdvp) ||
tdp->i_effnlink >= UFS_LINK_MAX) {
error = EMLINK;
goto unlockout;
}
MPASS(want_seqc_end);
if (tvp != NULL)
vn_seqc_write_end(tvp);