67 lines
1.8 KiB
Diff
67 lines
1.8 KiB
Diff
autofs-5.1.9 - fix lock ordering deadlock in expire_cleanup()
|
|
|
|
From: Ian Kent <raven@themaw.net>
|
|
|
|
Commit 81ac572466e3 ("autofs-5.1.9 - fix submount shutdown race")
|
|
introduced a lock ordering deadlock between the state mutex and the
|
|
mounts hash list mutex when fixing a submount shutdown race. It's enough
|
|
to just move the conditional alarm set function call outside of the
|
|
state mutex critical section to fix it.
|
|
|
|
Fixes: 81ac572466e3 ("autofs-5.1.9 - fix submount shutdown race")
|
|
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
---
|
|
daemon/state.c | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
--- autofs-5.1.4.orig/daemon/state.c
|
|
+++ autofs-5.1.4/daemon/state.c
|
|
@@ -86,8 +86,9 @@ void expire_cleanup(void *arg)
|
|
pthread_t thid = pthread_self();
|
|
struct expire_args *ec;
|
|
struct autofs_point *ap;
|
|
- int success;
|
|
enum states next = ST_INVAL;
|
|
+ unsigned int need_alarm = 0;
|
|
+ int success;
|
|
|
|
ec = (struct expire_args *) arg;
|
|
ap = ec->ap;
|
|
@@ -123,7 +124,7 @@ void expire_cleanup(void *arg)
|
|
}
|
|
|
|
if (ap->state == ST_EXPIRE)
|
|
- conditional_alarm_add(ap, ap->exp_runfreq);
|
|
+ need_alarm = 1;
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
@@ -140,7 +141,7 @@ void expire_cleanup(void *arg)
|
|
rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
|
|
if (!rv && !idle && !ap->shutdown) {
|
|
next = ST_READY;
|
|
- conditional_alarm_add(ap, ap->exp_runfreq);
|
|
+ need_alarm = 1;
|
|
break;
|
|
}
|
|
|
|
@@ -153,7 +154,7 @@ void expire_cleanup(void *arg)
|
|
|
|
/* Failed shutdown returns to ready */
|
|
warn(ap->logopt, "filesystem %s still busy", ap->path);
|
|
- conditional_alarm_add(ap, ap->exp_runfreq);
|
|
+ need_alarm = 1;
|
|
next = ST_READY;
|
|
break;
|
|
#endif
|
|
@@ -180,6 +181,9 @@ void expire_cleanup(void *arg)
|
|
|
|
st_mutex_unlock();
|
|
|
|
+ if (need_alarm)
|
|
+ conditional_alarm_add(ap, ap->exp_runfreq);
|
|
+
|
|
return;
|
|
}
|
|
|