We should not deadlock the kernel, or wait infinitely in case the user users incorrect mount options. One example is when indirect mount and mount offsets are bind mounts which are not private, and automount waits to complete a mount propagation. Use the expire timeout as the limit to wait for automount to complete, or return -EWOULDBLOCK/-EAGAIN. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c index b04c528b19d3..da1f01a73ffb 100644 --- a/fs/autofs/waitq.c +++ b/fs/autofs/waitq.c @@ -476,8 +476,11 @@ int autofs_wait(struct autofs_sb_info *sbi, * wq->name.name is NULL iff the lock is already released * or the mount has been made catatonic. */ - wait_event_killable(wq->queue, wq->name.name == NULL); - status = wq->status; + status = wait_event_killable_timeout(wq->queue, wq->name.name == NULL, sbi->exp_timeout); + if (status > 0) + status = wq->status; + else if (status == 0) + status = -EAGAIN; /* * For direct and offset mounts we need to track the requester's -- Goldwyn