git: 5f41ed8d0978 - stable/14 - msdosfs: fix directory corruption after rename operation

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Tue, 20 Feb 2024 21:48:55 UTC
The branch stable/14 has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f41ed8d0978ec9760c901958aec77f2acd803ec

commit 5f41ed8d0978ec9760c901958aec77f2acd803ec
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-02-17 21:04:49 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-02-20 21:48:08 +0000

    msdosfs: fix directory corruption after rename operation
    
    (cherry picked from commit 8b67c670a49b4efe7e1557121b5bbae682ea3bc7)
---
 sys/fs/msdosfs/msdosfs_vnops.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 31d9b003a6fa..078ea5e52312 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1180,8 +1180,10 @@ relock:
 	memcpy(oldname, fip->de_Name, 11);
 	memcpy(fip->de_Name, toname, 11);	/* update denode */
 	error = msdosfs_lookup_ino(tdvp, NULL, tcnp, &scn, &blkoff);
-	if (error == EJUSTRETURN)
+	if (error == EJUSTRETURN) {
+		tdip->de_fndoffset = to_diroffset;
 		error = createde(fip, tdip, NULL, tcnp);
+	}
 	if (error != 0) {
 		memcpy(fip->de_Name, oldname, 11);
 		goto unlock;