From a32ba4e63e6709e10bad56814283fd005b3a7f5d Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sat, 23 Aug 2014 11:38:31 +0000 Subject: [PATCH] Add comment explaining one of the quirks in autofs. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- sys/fs/autofs/autofs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/fs/autofs/autofs.c b/sys/fs/autofs/autofs.c index d3ea03dff9b..d5a68921bc8 100644 --- a/sys/fs/autofs/autofs.c +++ b/sys/fs/autofs/autofs.c @@ -595,6 +595,14 @@ autofs_open(struct cdev *dev, int flags, int fmt, struct thread *td) { sx_xlock(&sc->sc_lock); + /* + * We must never block automountd(8) and its descendants, and we use + * session ID to determine that: we store session id of the process + * that opened the device, and then compare it with session ids + * of triggering processes. This means running a second automountd(8) + * instance would break the previous one. The check below prevents + * it from happening. + */ if (sc->sc_dev_opened) { sx_xunlock(&sc->sc_lock); return (EBUSY);