Skip to content

Commit

Permalink
autofs4: use wait_event_killable
Browse files Browse the repository at this point in the history
This playing with signals to allow only fatal signals appears to predate
the introduction of wait_event_killable(), and I'm fairly sure that
wait_event_killable is what was meant to happen here.

[[email protected]: use wake_up() instead of wake_up_interruptible]
  Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Matthew Wilcox <[email protected]>
Acked-by: Ian Kent <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Stephen Rothwell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Matthew Wilcox authored and torvalds committed Apr 11, 2018
1 parent 1a6a05a commit ad12c3a
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions fs/autofs4/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
*/
static autofs_wqt_t autofs4_next_wait_queue = 1;

/* These are the signals we allow interrupting a pending mount */
#define SHUTDOWN_SIGS (sigmask(SIGKILL) | sigmask(SIGINT) | sigmask(SIGQUIT))

void autofs4_catatonic_mode(struct autofs_sb_info *sbi)
{
struct autofs_wait_queue *wq, *nwq;
Expand Down Expand Up @@ -486,29 +483,7 @@ int autofs4_wait(struct autofs_sb_info *sbi,
* wq->name.name is NULL iff the lock is already released
* or the mount has been made catatonic.
*/
if (wq->name.name) {
/* Block all but "shutdown" signals while waiting */
unsigned long shutdown_sigs_mask;
unsigned long irqflags;
sigset_t oldset;

spin_lock_irqsave(&current->sighand->siglock, irqflags);
oldset = current->blocked;
shutdown_sigs_mask = SHUTDOWN_SIGS & ~oldset.sig[0];
siginitsetinv(&current->blocked, shutdown_sigs_mask);
recalc_sigpending();
spin_unlock_irqrestore(&current->sighand->siglock, irqflags);

wait_event_interruptible(wq->queue, wq->name.name == NULL);

spin_lock_irqsave(&current->sighand->siglock, irqflags);
current->blocked = oldset;
recalc_sigpending();
spin_unlock_irqrestore(&current->sighand->siglock, irqflags);
} else {
pr_debug("skipped sleeping\n");
}

wait_event_killable(wq->queue, wq->name.name == NULL);
status = wq->status;

/*
Expand Down Expand Up @@ -574,7 +549,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok
kfree(wq->name.name);
wq->name.name = NULL; /* Do not wait on this queue */
wq->status = status;
wake_up_interruptible(&wq->queue);
wake_up(&wq->queue);
if (!--wq->wait_ctr)
kfree(wq);
mutex_unlock(&sbi->wq_mutex);
Expand Down

0 comments on commit ad12c3a

Please sign in to comment.