git: 2ce0f6fb8d83 - stable/13 - msdosfs_rename(): implement several XXXs about downgrading to ro

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 25 Jan 2024 04:32:11 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ce0f6fb8d830913b978bd5ff8a1fbdab94a3ce5

commit 2ce0f6fb8d830913b978bd5ff8a1fbdab94a3ce5
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-01-17 23:05:55 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-01-24 13:04:38 +0000

    msdosfs_rename(): implement several XXXs about downgrading to ro
    
    (cherry picked from commit 661db9b390b4a40418d838876b58d2186d72aabf)
---
 sys/fs/msdosfs/msdosfs_vnops.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index a2fc115e2ca5..1d296c019331 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1215,7 +1215,10 @@ relock:
 	MPASS(error == 0);
 	error = removede(fdip, fip);
 	if (error != 0) {
-		/* XXX should downgrade to ro here, fs is corrupt */
+		printf("%s: removede %s %s err %d\n",
+		    pmp->pm_mountp->mnt_stat.f_mntonname,
+		    fdip->de_Name, fip->de_Name, error);
+		msdosfs_integrity_error(pmp);
 		goto unlock;
 	}
 	if (!doingdirectory) {
@@ -1249,7 +1252,10 @@ relock:
 		error = bread(pmp->pm_devvp, bn, pmp->pm_bpcluster,
 		    NOCRED, &bp);
 		if (error != 0) {
-			/* XXX should downgrade to ro here, fs is corrupt */
+			printf("%s: block read error %d while renaming dir\n",
+			    pmp->pm_mountp->mnt_stat.f_mntonname,
+			    error);
+			msdosfs_integrity_error(pmp);
 			goto unlock;
 		}
 		dotdotp = (struct direntry *)bp->b_data + 1;
@@ -1262,7 +1268,10 @@ relock:
 		if (DOINGASYNC(fvp))
 			bdwrite(bp);
 		else if ((error = bwrite(bp)) != 0) {
-			/* XXX should downgrade to ro here, fs is corrupt */
+			printf("%s: block write error %d while renaming dir\n",
+			    pmp->pm_mountp->mnt_stat.f_mntonname,
+			    error);
+			msdosfs_integrity_error(pmp);
 			goto unlock;
 		}
 	}