| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved |
|---|
| 3 | 4 | * Copyright 2005-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 | /* Internal header file for autofs */ |
|---|
| .. | .. |
|---|
| 42 | 39 | #endif |
|---|
| 43 | 40 | #define pr_fmt(fmt) KBUILD_MODNAME ":pid:%d:%s: " fmt, current->pid, __func__ |
|---|
| 44 | 41 | |
|---|
| 42 | +extern struct file_system_type autofs_fs_type; |
|---|
| 43 | + |
|---|
| 45 | 44 | /* |
|---|
| 46 | 45 | * Unified info structure. This is pointed to by both the dentry and |
|---|
| 47 | 46 | * inode structures. Each file in the filesystem has an instance of this |
|---|
| .. | .. |
|---|
| 59 | 58 | struct completion expire_complete; |
|---|
| 60 | 59 | |
|---|
| 61 | 60 | struct list_head active; |
|---|
| 62 | | - int active_count; |
|---|
| 63 | 61 | |
|---|
| 64 | 62 | struct list_head expiring; |
|---|
| 65 | 63 | |
|---|
| 66 | 64 | struct autofs_sb_info *sbi; |
|---|
| 67 | 65 | unsigned long last_used; |
|---|
| 68 | | - atomic_t count; |
|---|
| 66 | + int count; |
|---|
| 69 | 67 | |
|---|
| 70 | 68 | kuid_t uid; |
|---|
| 71 | 69 | kgid_t gid; |
|---|
| 70 | + struct rcu_head rcu; |
|---|
| 72 | 71 | }; |
|---|
| 73 | 72 | |
|---|
| 74 | 73 | #define AUTOFS_INF_EXPIRING (1<<0) /* dentry in the process of expiring */ |
|---|
| .. | .. |
|---|
| 101 | 100 | |
|---|
| 102 | 101 | #define AUTOFS_SBI_MAGIC 0x6d4a556d |
|---|
| 103 | 102 | |
|---|
| 103 | +#define AUTOFS_SBI_CATATONIC 0x0001 |
|---|
| 104 | +#define AUTOFS_SBI_STRICTEXPIRE 0x0002 |
|---|
| 105 | +#define AUTOFS_SBI_IGNORE 0x0004 |
|---|
| 106 | + |
|---|
| 104 | 107 | struct autofs_sb_info { |
|---|
| 105 | 108 | u32 magic; |
|---|
| 106 | 109 | int pipefd; |
|---|
| 107 | 110 | struct file *pipe; |
|---|
| 108 | 111 | struct pid *oz_pgrp; |
|---|
| 109 | | - int catatonic; |
|---|
| 110 | 112 | int version; |
|---|
| 111 | 113 | int sub_version; |
|---|
| 112 | 114 | int min_proto; |
|---|
| 113 | 115 | int max_proto; |
|---|
| 116 | + unsigned int flags; |
|---|
| 114 | 117 | unsigned long exp_timeout; |
|---|
| 115 | 118 | unsigned int type; |
|---|
| 116 | 119 | struct super_block *sb; |
|---|
| .. | .. |
|---|
| 126 | 129 | |
|---|
| 127 | 130 | static inline struct autofs_sb_info *autofs_sbi(struct super_block *sb) |
|---|
| 128 | 131 | { |
|---|
| 129 | | - return sb->s_magic != AUTOFS_SUPER_MAGIC ? |
|---|
| 130 | | - NULL : (struct autofs_sb_info *)(sb->s_fs_info); |
|---|
| 132 | + return (struct autofs_sb_info *)(sb->s_fs_info); |
|---|
| 131 | 133 | } |
|---|
| 132 | 134 | |
|---|
| 133 | 135 | static inline struct autofs_info *autofs_dentry_ino(struct dentry *dentry) |
|---|
| .. | .. |
|---|
| 141 | 143 | */ |
|---|
| 142 | 144 | static inline int autofs_oz_mode(struct autofs_sb_info *sbi) |
|---|
| 143 | 145 | { |
|---|
| 144 | | - return sbi->catatonic || task_pgrp(current) == sbi->oz_pgrp; |
|---|
| 146 | + return ((sbi->flags & AUTOFS_SBI_CATATONIC) || |
|---|
| 147 | + task_pgrp(current) == sbi->oz_pgrp); |
|---|
| 145 | 148 | } |
|---|
| 146 | 149 | |
|---|
| 147 | 150 | struct inode *autofs_get_inode(struct super_block *, umode_t); |
|---|
| .. | .. |
|---|
| 210 | 213 | return -EINVAL; |
|---|
| 211 | 214 | /* We want a packet pipe */ |
|---|
| 212 | 215 | pipe->f_flags |= O_DIRECT; |
|---|
| 216 | + /* We don't expect -EAGAIN */ |
|---|
| 217 | + pipe->f_flags &= ~O_NONBLOCK; |
|---|
| 213 | 218 | return 0; |
|---|
| 214 | 219 | } |
|---|
| 215 | 220 | |
|---|