diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2022-07-04 10:28:49 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2022-07-06 12:34:36 +0000 |
commit | 513e1bbc739239c9479367b15e5f863a5f891d66 (patch) | |
tree | 9b45fd5482d786e4d0b737a48c2f36fd5ee57c2a | |
parent | ab5ef5fb6355489e6a960b4d107e6767e2336ea2 (diff) | |
download | src-513e1bbc739239c9479367b15e5f863a5f891d66.tar.gz src-513e1bbc739239c9479367b15e5f863a5f891d66.zip |
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
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 976bc31841dd..918b1e7ab29c 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1576,17 +1576,17 @@ relock: * .. 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); |