diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -1006,7 +1006,9 @@ } MSDOSFS_UNLOCK_MP(pmp); - vfs_unbusy(pmp->pm_mountp); + do { + vfs_unbusy(pmp->pm_mountp); + } while (--pending >= 0); } void @@ -1015,11 +1017,19 @@ int error; error = vfs_busy(pmp->pm_mountp, MBF_NOWAIT); - if (error == 0) - taskqueue_enqueue(taskqueue_thread, &pmp->pm_rw2ro_task); - else + if (error == 0) { + error = taskqueue_enqueue(taskqueue_thread, + &pmp->pm_rw2ro_task); + if (error != 0) { + printf("%s: integrity error scheduling failed, " + "error %d\n", + pmp->pm_mountp->mnt_stat.f_mntfromname, error); + vfs_unbusy(pmp->pm_mountp); + } + } else { printf("%s: integrity error busying failed, error %d\n", pmp->pm_mountp->mnt_stat.f_mntfromname, error); + } } static int diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1180,8 +1180,8 @@ memcpy(oldname, fip->de_Name, 11); memcpy(fip->de_Name, toname, 11); /* update denode */ error = msdosfs_lookup_ino(tdvp, NULL, tcnp, &scn, &blkoff); - MPASS(error == EJUSTRETURN); - error = createde(fip, tdip, NULL, tcnp); + if (error == EJUSTRETURN) + error = createde(fip, tdip, NULL, tcnp); if (error != 0) { memcpy(fip->de_Name, oldname, 11); goto unlock; @@ -1203,7 +1203,10 @@ 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) { @@ -1237,7 +1240,10 @@ 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; @@ -1250,7 +1256,10 @@ 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; } }