| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 1997-1998 Transmeta Corporation -- All Rights Reserved |
|---|
| 3 | 4 | * Copyright 2001-2006 Ian Kent <raven@themaw.net> |
|---|
| 4 | | - * |
|---|
| 5 | | - * This file is part of the Linux kernel and is made available under |
|---|
| 6 | | - * the terms of the GNU General Public License, version 2, or at your |
|---|
| 7 | | - * option, any later version, incorporated herein by reference. |
|---|
| 8 | 5 | */ |
|---|
| 9 | 6 | |
|---|
| 10 | 7 | #include <linux/sched/signal.h> |
|---|
| .. | .. |
|---|
| 20 | 17 | struct autofs_wait_queue *wq, *nwq; |
|---|
| 21 | 18 | |
|---|
| 22 | 19 | mutex_lock(&sbi->wq_mutex); |
|---|
| 23 | | - if (sbi->catatonic) { |
|---|
| 20 | + if (sbi->flags & AUTOFS_SBI_CATATONIC) { |
|---|
| 24 | 21 | mutex_unlock(&sbi->wq_mutex); |
|---|
| 25 | 22 | return; |
|---|
| 26 | 23 | } |
|---|
| 27 | 24 | |
|---|
| 28 | 25 | pr_debug("entering catatonic mode\n"); |
|---|
| 29 | 26 | |
|---|
| 30 | | - sbi->catatonic = 1; |
|---|
| 27 | + sbi->flags |= AUTOFS_SBI_CATATONIC; |
|---|
| 31 | 28 | wq = sbi->queues; |
|---|
| 32 | 29 | sbi->queues = NULL; /* Erase all wait queues */ |
|---|
| 33 | 30 | while (wq) { |
|---|
| .. | .. |
|---|
| 35 | 32 | wq->status = -ENOENT; /* Magic is gone - report failure */ |
|---|
| 36 | 33 | kfree(wq->name.name); |
|---|
| 37 | 34 | wq->name.name = NULL; |
|---|
| 38 | | - wq->wait_ctr--; |
|---|
| 39 | 35 | wake_up_interruptible(&wq->queue); |
|---|
| 36 | + if (!--wq->wait_ctr) |
|---|
| 37 | + kfree(wq); |
|---|
| 40 | 38 | wq = nwq; |
|---|
| 41 | 39 | } |
|---|
| 42 | 40 | fput(sbi->pipe); /* Close the pipe */ |
|---|
| .. | .. |
|---|
| 56 | 54 | |
|---|
| 57 | 55 | mutex_lock(&sbi->pipe_mutex); |
|---|
| 58 | 56 | while (bytes) { |
|---|
| 59 | | - wr = __kernel_write(file, data, bytes, &file->f_pos); |
|---|
| 57 | + wr = __kernel_write(file, data, bytes, NULL); |
|---|
| 60 | 58 | if (wr <= 0) |
|---|
| 61 | 59 | break; |
|---|
| 62 | 60 | data += wr; |
|---|
| .. | .. |
|---|
| 255 | 253 | struct autofs_wait_queue *wq; |
|---|
| 256 | 254 | struct autofs_info *ino; |
|---|
| 257 | 255 | |
|---|
| 258 | | - if (sbi->catatonic) |
|---|
| 256 | + if (sbi->flags & AUTOFS_SBI_CATATONIC) |
|---|
| 259 | 257 | return -ENOENT; |
|---|
| 260 | 258 | |
|---|
| 261 | 259 | /* Wait in progress, continue; */ |
|---|
| .. | .. |
|---|
| 290 | 288 | if (mutex_lock_interruptible(&sbi->wq_mutex)) |
|---|
| 291 | 289 | return -EINTR; |
|---|
| 292 | 290 | |
|---|
| 293 | | - if (sbi->catatonic) |
|---|
| 291 | + if (sbi->flags & AUTOFS_SBI_CATATONIC) |
|---|
| 294 | 292 | return -ENOENT; |
|---|
| 295 | 293 | |
|---|
| 296 | 294 | wq = autofs_find_wait(sbi, qstr); |
|---|
| .. | .. |
|---|
| 359 | 357 | pid_t tgid; |
|---|
| 360 | 358 | |
|---|
| 361 | 359 | /* In catatonic mode, we don't wait for nobody */ |
|---|
| 362 | | - if (sbi->catatonic) |
|---|
| 360 | + if (sbi->flags & AUTOFS_SBI_CATATONIC) |
|---|
| 363 | 361 | return -ENOENT; |
|---|
| 364 | 362 | |
|---|
| 365 | 363 | /* |
|---|