aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-01-18 15:35:56 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-01-18 16:48:05 +0000
commit13ccb04589e2c5c840e19b407a59e44cb70ac28e (patch)
treef2b03522941e398c29066c0ea8e83e224310c95b
parent661db9b390b4a40418d838876b58d2186d72aabf (diff)
msdosfs_integrity_error(): plug possible busy leak
If taskqueue_enqueue() returned error, unbusy(). Handle parallel calls to msdosfs_integrity_error() by unbusying in msdosfs_remount_ro() up to pending times. Noted and reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43482
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index df96bcbfe9c6..03c794bad900 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -1006,7 +1006,9 @@ msdosfs_remount_ro(void *arg, int pending)
}
MSDOSFS_UNLOCK_MP(pmp);
- vfs_unbusy(pmp->pm_mountp);
+ do {
+ vfs_unbusy(pmp->pm_mountp);
+ } while (--pending >= 0);
}
void
@@ -1015,11 +1017,19 @@ msdosfs_integrity_error(struct msdosfsmount *pmp)
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