1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

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
This commit is contained in:
Jason A. Harmening 2021-08-07 22:31:02 -07:00
parent a8c732f4e5
commit e81e71b0e9

View File

@ -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);