git: e81e71b0e9cb - main - Use interruptible wait for blocking recursive unmounts

Jason A. Harmening jah at FreeBSD.org
Fri Aug 20 20:18:35 UTC 2021


The branch main has been updated by jah:

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

commit e81e71b0e9cbb5515ffb31bf80088fd7b20e7994
Author:     Jason A. Harmening <jah at FreeBSD.org>
AuthorDate: 2021-08-08 05:31:02 +0000
Commit:     Jason A. Harmening <jah at FreeBSD.org>
CommitDate: 2021-08-20 20:21:56 +0000

    Use interruptible wait for blocking recursive unmounts
    
    Now that we allow recursive unmount attempts to be abandoned upon
    exceeding the retry limit, we should avoid leaving an unkillable
    thread when a synchronous unmount request was issued against the
    base filesystem.
    
    Reviewed by:    kib (earlier revision), mkusick
    Differential Revision:  https://reviews.freebsd.org/D31450
---
 sys/kern/vfs_mount.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 0fb5694ebed5..166d7336eaf1 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -2084,10 +2084,15 @@ dounmount(struct mount *mp, uint64_t flags, struct thread *td)
 		 * just re-enqueue on the end of the taskqueue.
 		 */
 		if ((flags & MNT_DEFERRED) == 0) {
-			while (!TAILQ_EMPTY(&mp->mnt_uppers)) {
+			while (error == 0 && !TAILQ_EMPTY(&mp->mnt_uppers)) {
 				mp->mnt_kern_flag |= MNTK_TASKQUEUE_WAITER;
-				msleep(&mp->mnt_taskqueue_link, MNT_MTX(mp), 0,
-				    "umntqw", 0);
+				error = msleep(&mp->mnt_taskqueue_link,
+				    MNT_MTX(mp), PCATCH, "umntqw", 0);
+			}
+			if (error != 0) {
+				MNT_REL(mp);
+				MNT_IUNLOCK(mp);
+				return (error);
 			}
 		} else if (!TAILQ_EMPTY(&mp->mnt_uppers)) {
 			MNT_IUNLOCK(mp);


More information about the dev-commits-src-all mailing list