Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2001 Clemson University and The University of Chicago |
| 3 | * |
| 4 | * Changes by Acxiom Corporation to add protocol version to kernel |
| 5 | * communication, Copyright Acxiom Corporation, 2005. |
| 6 | * |
| 7 | * See COPYING in top-level directory. |
| 8 | */ |
| 9 | |
| 10 | #include "protocol.h" |
Mike Marshall | 575e946 | 2015-12-04 12:56:14 -0500 | [diff] [blame] | 11 | #include "orangefs-kernel.h" |
| 12 | #include "orangefs-dev-proto.h" |
| 13 | #include "orangefs-bufmap.h" |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 14 | |
| 15 | #include <linux/debugfs.h> |
| 16 | #include <linux/slab.h> |
| 17 | |
| 18 | /* this file implements the /dev/pvfs2-req device node */ |
| 19 | |
Martin Brandenburg | f2ee3b7 | 2016-08-09 15:59:26 -0400 | [diff] [blame^] | 20 | uint32_t userspace_version; |
| 21 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 22 | static int open_access_count; |
| 23 | |
| 24 | #define DUMP_DEVICE_ERROR() \ |
| 25 | do { \ |
| 26 | gossip_err("*****************************************************\n");\ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 27 | gossip_err("ORANGEFS Device Error: You cannot open the device file "); \ |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 28 | gossip_err("\n/dev/%s more than once. Please make sure that\nthere " \ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 29 | "are no ", ORANGEFS_REQDEVICE_NAME); \ |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 30 | gossip_err("instances of a program using this device\ncurrently " \ |
| 31 | "running. (You must verify this!)\n"); \ |
| 32 | gossip_err("For example, you can use the lsof program as follows:\n");\ |
| 33 | gossip_err("'lsof | grep %s' (run this as root)\n", \ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 34 | ORANGEFS_REQDEVICE_NAME); \ |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 35 | gossip_err(" open_access_count = %d\n", open_access_count); \ |
| 36 | gossip_err("*****************************************************\n");\ |
| 37 | } while (0) |
| 38 | |
| 39 | static int hash_func(__u64 tag, int table_size) |
| 40 | { |
Mike Marshall | 2c590d5 | 2015-07-24 10:37:15 -0400 | [diff] [blame] | 41 | return do_div(tag, (unsigned int)table_size); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 42 | } |
| 43 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 44 | static void orangefs_devreq_add_op(struct orangefs_kernel_op_s *op) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 45 | { |
| 46 | int index = hash_func(op->tag, hash_table_size); |
| 47 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 48 | list_add_tail(&op->list, &htable_ops_in_progress[index]); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 49 | } |
| 50 | |
Mike Marshall | ca9f518 | 2016-02-26 10:21:12 -0500 | [diff] [blame] | 51 | /* |
| 52 | * find the op with this tag and remove it from the in progress |
| 53 | * hash table. |
| 54 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 55 | static struct orangefs_kernel_op_s *orangefs_devreq_remove_op(__u64 tag) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 56 | { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 57 | struct orangefs_kernel_op_s *op, *next; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 58 | int index; |
| 59 | |
| 60 | index = hash_func(tag, hash_table_size); |
| 61 | |
| 62 | spin_lock(&htable_ops_in_progress_lock); |
| 63 | list_for_each_entry_safe(op, |
| 64 | next, |
| 65 | &htable_ops_in_progress[index], |
| 66 | list) { |
Al Viro | 05a50a5 | 2016-02-18 18:59:44 -0500 | [diff] [blame] | 67 | if (op->tag == tag && !op_state_purged(op) && |
| 68 | !op_state_given_up(op)) { |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 69 | list_del_init(&op->list); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 70 | spin_unlock(&htable_ops_in_progress_lock); |
| 71 | return op; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | spin_unlock(&htable_ops_in_progress_lock); |
| 76 | return NULL; |
| 77 | } |
| 78 | |
Martin Brandenburg | acfcbaf | 2016-03-05 13:17:39 -0500 | [diff] [blame] | 79 | /* Returns whether any FS are still pending remounted */ |
| 80 | static int mark_all_pending_mounts(void) |
| 81 | { |
| 82 | int unmounted = 1; |
| 83 | struct orangefs_sb_info_s *orangefs_sb = NULL; |
| 84 | |
| 85 | spin_lock(&orangefs_superblocks_lock); |
| 86 | list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) { |
| 87 | /* All of these file system require a remount */ |
| 88 | orangefs_sb->mount_pending = 1; |
| 89 | unmounted = 0; |
| 90 | } |
| 91 | spin_unlock(&orangefs_superblocks_lock); |
| 92 | return unmounted; |
| 93 | } |
| 94 | |
| 95 | /* |
| 96 | * Determine if a given file system needs to be remounted or not |
| 97 | * Returns -1 on error |
| 98 | * 0 if already mounted |
| 99 | * 1 if needs remount |
| 100 | */ |
| 101 | static int fs_mount_pending(__s32 fsid) |
| 102 | { |
| 103 | int mount_pending = -1; |
| 104 | struct orangefs_sb_info_s *orangefs_sb = NULL; |
| 105 | |
| 106 | spin_lock(&orangefs_superblocks_lock); |
| 107 | list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) { |
| 108 | if (orangefs_sb->fs_id == fsid) { |
| 109 | mount_pending = orangefs_sb->mount_pending; |
| 110 | break; |
| 111 | } |
| 112 | } |
| 113 | spin_unlock(&orangefs_superblocks_lock); |
| 114 | return mount_pending; |
| 115 | } |
| 116 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 117 | static int orangefs_devreq_open(struct inode *inode, struct file *file) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 118 | { |
| 119 | int ret = -EINVAL; |
| 120 | |
Jann Horn | 78fee0b | 2016-06-25 01:51:52 +0200 | [diff] [blame] | 121 | /* in order to ensure that the filesystem driver sees correct UIDs */ |
| 122 | if (file->f_cred->user_ns != &init_user_ns) { |
| 123 | gossip_err("%s: device cannot be opened outside init_user_ns\n", |
| 124 | __func__); |
| 125 | goto out; |
| 126 | } |
| 127 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 128 | if (!(file->f_flags & O_NONBLOCK)) { |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 129 | gossip_err("%s: device cannot be opened in blocking mode\n", |
| 130 | __func__); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 131 | goto out; |
| 132 | } |
| 133 | ret = -EACCES; |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 134 | gossip_debug(GOSSIP_DEV_DEBUG, "client-core: opening device\n"); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 135 | mutex_lock(&devreq_mutex); |
| 136 | |
| 137 | if (open_access_count == 0) { |
Al Viro | fee25ce | 2016-01-22 19:46:08 -0500 | [diff] [blame] | 138 | open_access_count = 1; |
Al Viro | fb6d252 | 2016-01-19 12:00:26 -0500 | [diff] [blame] | 139 | ret = 0; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 140 | } else { |
| 141 | DUMP_DEVICE_ERROR(); |
| 142 | } |
| 143 | mutex_unlock(&devreq_mutex); |
| 144 | |
| 145 | out: |
| 146 | |
| 147 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 148 | "pvfs2-client-core: open device complete (ret = %d)\n", |
| 149 | ret); |
| 150 | return ret; |
| 151 | } |
| 152 | |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 153 | /* Function for read() callers into the device */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 154 | static ssize_t orangefs_devreq_read(struct file *file, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 155 | char __user *buf, |
| 156 | size_t count, loff_t *offset) |
| 157 | { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 158 | struct orangefs_kernel_op_s *op, *temp; |
| 159 | __s32 proto_ver = ORANGEFS_KERNEL_PROTO_VERSION; |
| 160 | static __s32 magic = ORANGEFS_DEVREQ_MAGIC; |
| 161 | struct orangefs_kernel_op_s *cur_op = NULL; |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 162 | unsigned long ret; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 163 | |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 164 | /* We do not support blocking IO. */ |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 165 | if (!(file->f_flags & O_NONBLOCK)) { |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 166 | gossip_err("%s: blocking read from client-core.\n", |
| 167 | __func__); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 168 | return -EINVAL; |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | /* |
Martin Brandenburg | a762ae6 | 2015-12-15 14:22:06 -0500 | [diff] [blame] | 172 | * The client will do an ioctl to find MAX_DEV_REQ_UPSIZE, then |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 173 | * always read with that size buffer. |
| 174 | */ |
Martin Brandenburg | a762ae6 | 2015-12-15 14:22:06 -0500 | [diff] [blame] | 175 | if (count != MAX_DEV_REQ_UPSIZE) { |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 176 | gossip_err("orangefs: client-core tried to read wrong size\n"); |
| 177 | return -EINVAL; |
| 178 | } |
| 179 | |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 180 | restart: |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 181 | /* Get next op (if any) from top of list. */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 182 | spin_lock(&orangefs_request_list_lock); |
| 183 | list_for_each_entry_safe(op, temp, &orangefs_request_list, list) { |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 184 | __s32 fsid; |
| 185 | /* This lock is held past the end of the loop when we break. */ |
| 186 | spin_lock(&op->lock); |
Al Viro | 05a50a5 | 2016-02-18 18:59:44 -0500 | [diff] [blame] | 187 | if (unlikely(op_state_purged(op) || op_state_given_up(op))) { |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 188 | spin_unlock(&op->lock); |
| 189 | continue; |
| 190 | } |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 191 | |
| 192 | fsid = fsid_of_op(op); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 193 | if (fsid != ORANGEFS_FS_ID_NULL) { |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 194 | int ret; |
| 195 | /* Skip ops whose filesystem needs to be mounted. */ |
| 196 | ret = fs_mount_pending(fsid); |
| 197 | if (ret == 1) { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 198 | gossip_debug(GOSSIP_DEV_DEBUG, |
Mike Marshall | 5090c96 | 2016-02-04 13:29:27 -0500 | [diff] [blame] | 199 | "%s: mount pending, skipping op tag " |
| 200 | "%llu %s\n", |
| 201 | __func__, |
| 202 | llu(op->tag), |
| 203 | get_opname_string(op)); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 204 | spin_unlock(&op->lock); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 205 | continue; |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 206 | /* |
| 207 | * Skip ops whose filesystem we don't know about unless |
| 208 | * it is being mounted. |
| 209 | */ |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 210 | /* XXX: is there a better way to detect this? */ |
| 211 | } else if (ret == -1 && |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 212 | !(op->upcall.type == |
| 213 | ORANGEFS_VFS_OP_FS_MOUNT || |
| 214 | op->upcall.type == |
| 215 | ORANGEFS_VFS_OP_GETATTR)) { |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 216 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 217 | "orangefs: skipping op tag %llu %s\n", |
| 218 | llu(op->tag), get_opname_string(op)); |
| 219 | gossip_err( |
| 220 | "orangefs: ERROR: fs_mount_pending %d\n", |
| 221 | fsid); |
| 222 | spin_unlock(&op->lock); |
| 223 | continue; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 224 | } |
| 225 | } |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 226 | /* |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 227 | * Either this op does not pertain to a filesystem, is mounting |
| 228 | * a filesystem, or pertains to a mounted filesystem. Let it |
| 229 | * through. |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 230 | */ |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 231 | cur_op = op; |
| 232 | break; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 233 | } |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 234 | |
| 235 | /* |
| 236 | * At this point we either have a valid op and can continue or have not |
| 237 | * found an op and must ask the client to try again later. |
| 238 | */ |
| 239 | if (!cur_op) { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 240 | spin_unlock(&orangefs_request_list_lock); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 241 | return -EAGAIN; |
| 242 | } |
| 243 | |
Mike Marshall | ca9f518 | 2016-02-26 10:21:12 -0500 | [diff] [blame] | 244 | gossip_debug(GOSSIP_DEV_DEBUG, "%s: reading op tag %llu %s\n", |
| 245 | __func__, |
| 246 | llu(cur_op->tag), |
| 247 | get_opname_string(cur_op)); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 248 | |
| 249 | /* |
| 250 | * Such an op should never be on the list in the first place. If so, we |
| 251 | * will abort. |
| 252 | */ |
| 253 | if (op_state_in_progress(cur_op) || op_state_serviced(cur_op)) { |
| 254 | gossip_err("orangefs: ERROR: Current op already queued.\n"); |
Al Viro | 05a50a5 | 2016-02-18 18:59:44 -0500 | [diff] [blame] | 255 | list_del_init(&cur_op->list); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 256 | spin_unlock(&cur_op->lock); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 257 | spin_unlock(&orangefs_request_list_lock); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 258 | return -EAGAIN; |
| 259 | } |
Mike Marshall | ca9f518 | 2016-02-26 10:21:12 -0500 | [diff] [blame] | 260 | |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 261 | list_del_init(&cur_op->list); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 262 | spin_unlock(&orangefs_request_list_lock); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 263 | |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 264 | spin_unlock(&cur_op->lock); |
| 265 | |
| 266 | /* Push the upcall out. */ |
| 267 | ret = copy_to_user(buf, &proto_ver, sizeof(__s32)); |
| 268 | if (ret != 0) |
| 269 | goto error; |
| 270 | ret = copy_to_user(buf+sizeof(__s32), &magic, sizeof(__s32)); |
| 271 | if (ret != 0) |
| 272 | goto error; |
| 273 | ret = copy_to_user(buf+2 * sizeof(__s32), &cur_op->tag, sizeof(__u64)); |
| 274 | if (ret != 0) |
| 275 | goto error; |
| 276 | ret = copy_to_user(buf+2*sizeof(__s32)+sizeof(__u64), &cur_op->upcall, |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 277 | sizeof(struct orangefs_upcall_s)); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 278 | if (ret != 0) |
| 279 | goto error; |
| 280 | |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 281 | spin_lock(&htable_ops_in_progress_lock); |
| 282 | spin_lock(&cur_op->lock); |
| 283 | if (unlikely(op_state_given_up(cur_op))) { |
| 284 | spin_unlock(&cur_op->lock); |
| 285 | spin_unlock(&htable_ops_in_progress_lock); |
Al Viro | 05a50a5 | 2016-02-18 18:59:44 -0500 | [diff] [blame] | 286 | complete(&cur_op->waitq); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 287 | goto restart; |
| 288 | } |
| 289 | |
| 290 | /* |
| 291 | * Set the operation to be in progress and move it between lists since |
| 292 | * it has been sent to the client. |
| 293 | */ |
| 294 | set_op_state_inprogress(cur_op); |
Mike Marshall | 9d9e7ba | 2016-03-03 13:46:48 -0500 | [diff] [blame] | 295 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 296 | "%s: 1 op:%s: op_state:%d: process:%s:\n", |
| 297 | __func__, |
| 298 | get_opname_string(cur_op), |
| 299 | cur_op->op_state, |
| 300 | current->comm); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 301 | orangefs_devreq_add_op(cur_op); |
| 302 | spin_unlock(&cur_op->lock); |
| 303 | spin_unlock(&htable_ops_in_progress_lock); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 304 | |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 305 | /* The client only asks to read one size buffer. */ |
Martin Brandenburg | a762ae6 | 2015-12-15 14:22:06 -0500 | [diff] [blame] | 306 | return MAX_DEV_REQ_UPSIZE; |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 307 | error: |
| 308 | /* |
| 309 | * We were unable to copy the op data to the client. Put the op back in |
| 310 | * list. If client has crashed, the op will be purged later when the |
| 311 | * device is released. |
| 312 | */ |
| 313 | gossip_err("orangefs: Failed to copy data to user space\n"); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 314 | spin_lock(&orangefs_request_list_lock); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 315 | spin_lock(&cur_op->lock); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 316 | if (likely(!op_state_given_up(cur_op))) { |
| 317 | set_op_state_waiting(cur_op); |
Mike Marshall | 9d9e7ba | 2016-03-03 13:46:48 -0500 | [diff] [blame] | 318 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 319 | "%s: 2 op:%s: op_state:%d: process:%s:\n", |
| 320 | __func__, |
| 321 | get_opname_string(cur_op), |
| 322 | cur_op->op_state, |
| 323 | current->comm); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 324 | list_add(&cur_op->list, &orangefs_request_list); |
Al Viro | 05a50a5 | 2016-02-18 18:59:44 -0500 | [diff] [blame] | 325 | spin_unlock(&cur_op->lock); |
| 326 | } else { |
| 327 | spin_unlock(&cur_op->lock); |
| 328 | complete(&cur_op->waitq); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 329 | } |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 330 | spin_unlock(&orangefs_request_list_lock); |
Martin Brandenburg | 24c8d08 | 2015-11-13 14:26:10 -0500 | [diff] [blame] | 331 | return -EFAULT; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 332 | } |
| 333 | |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 334 | /* |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 335 | * Function for writev() callers into the device. |
| 336 | * |
| 337 | * Userspace should have written: |
| 338 | * - __u32 version |
| 339 | * - __u32 magic |
| 340 | * - __u64 tag |
| 341 | * - struct orangefs_downcall_s |
| 342 | * - trailer buffer (in the case of READDIR operations) |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 343 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 344 | static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 345 | struct iov_iter *iter) |
| 346 | { |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 347 | ssize_t ret; |
| 348 | struct orangefs_kernel_op_s *op = NULL; |
| 349 | struct { |
| 350 | __u32 version; |
| 351 | __u32 magic; |
| 352 | __u64 tag; |
| 353 | } head; |
| 354 | int total = ret = iov_iter_count(iter); |
| 355 | int n; |
| 356 | int downcall_size = sizeof(struct orangefs_downcall_s); |
| 357 | int head_size = sizeof(head); |
| 358 | |
| 359 | gossip_debug(GOSSIP_DEV_DEBUG, "%s: total:%d: ret:%zd:\n", |
| 360 | __func__, |
| 361 | total, |
| 362 | ret); |
| 363 | |
| 364 | if (total < MAX_DEV_REQ_DOWNSIZE) { |
Mike Marshall | cf0c277 | 2016-01-19 12:04:40 -0500 | [diff] [blame] | 365 | gossip_err("%s: total:%d: must be at least:%u:\n", |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 366 | __func__, |
| 367 | total, |
Mike Marshall | cf0c277 | 2016-01-19 12:04:40 -0500 | [diff] [blame] | 368 | (unsigned int) MAX_DEV_REQ_DOWNSIZE); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 369 | return -EFAULT; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 370 | } |
| 371 | |
| 372 | n = copy_from_iter(&head, head_size, iter); |
| 373 | if (n < head_size) { |
| 374 | gossip_err("%s: failed to copy head.\n", __func__); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 375 | return -EFAULT; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 376 | } |
| 377 | |
| 378 | if (head.version < ORANGEFS_MINIMUM_USERSPACE_VERSION) { |
| 379 | gossip_err("%s: userspace claims version" |
| 380 | "%d, minimum version required: %d.\n", |
| 381 | __func__, |
| 382 | head.version, |
| 383 | ORANGEFS_MINIMUM_USERSPACE_VERSION); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 384 | return -EPROTO; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | if (head.magic != ORANGEFS_DEVREQ_MAGIC) { |
| 388 | gossip_err("Error: Device magic number does not match.\n"); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 389 | return -EPROTO; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 390 | } |
| 391 | |
Martin Brandenburg | f2ee3b7 | 2016-08-09 15:59:26 -0400 | [diff] [blame^] | 392 | if (!userspace_version) { |
| 393 | userspace_version = head.version; |
| 394 | } else if (userspace_version != head.version) { |
| 395 | gossip_err("Error: userspace version changes\n"); |
| 396 | return -EPROTO; |
| 397 | } |
| 398 | |
Mike Marshall | ca9f518 | 2016-02-26 10:21:12 -0500 | [diff] [blame] | 399 | /* remove the op from the in progress hash table */ |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 400 | op = orangefs_devreq_remove_op(head.tag); |
| 401 | if (!op) { |
| 402 | gossip_err("WARNING: No one's waiting for tag %llu\n", |
| 403 | llu(head.tag)); |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 404 | return ret; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 405 | } |
| 406 | |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 407 | n = copy_from_iter(&op->downcall, downcall_size, iter); |
| 408 | if (n != downcall_size) { |
| 409 | gossip_err("%s: failed to copy downcall.\n", __func__); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 410 | goto Efault; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | if (op->downcall.status) |
| 414 | goto wakeup; |
| 415 | |
| 416 | /* |
| 417 | * We've successfully peeled off the head and the downcall. |
| 418 | * Something has gone awry if total doesn't equal the |
| 419 | * sum of head_size, downcall_size and trailer_size. |
| 420 | */ |
| 421 | if ((head_size + downcall_size + op->downcall.trailer_size) != total) { |
| 422 | gossip_err("%s: funky write, head_size:%d" |
| 423 | ": downcall_size:%d: trailer_size:%lld" |
| 424 | ": total size:%d:\n", |
| 425 | __func__, |
| 426 | head_size, |
| 427 | downcall_size, |
| 428 | op->downcall.trailer_size, |
| 429 | total); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 430 | goto Efault; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | /* Only READDIR operations should have trailers. */ |
| 434 | if ((op->downcall.type != ORANGEFS_VFS_OP_READDIR) && |
| 435 | (op->downcall.trailer_size != 0)) { |
| 436 | gossip_err("%s: %x operation with trailer.", |
| 437 | __func__, |
| 438 | op->downcall.type); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 439 | goto Efault; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | /* READDIR operations should always have trailers. */ |
| 443 | if ((op->downcall.type == ORANGEFS_VFS_OP_READDIR) && |
| 444 | (op->downcall.trailer_size == 0)) { |
| 445 | gossip_err("%s: %x operation with no trailer.", |
| 446 | __func__, |
| 447 | op->downcall.type); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 448 | goto Efault; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | if (op->downcall.type != ORANGEFS_VFS_OP_READDIR) |
| 452 | goto wakeup; |
| 453 | |
| 454 | op->downcall.trailer_buf = |
| 455 | vmalloc(op->downcall.trailer_size); |
| 456 | if (op->downcall.trailer_buf == NULL) { |
| 457 | gossip_err("%s: failed trailer vmalloc.\n", |
| 458 | __func__); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 459 | goto Enomem; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 460 | } |
| 461 | memset(op->downcall.trailer_buf, 0, op->downcall.trailer_size); |
| 462 | n = copy_from_iter(op->downcall.trailer_buf, |
| 463 | op->downcall.trailer_size, |
| 464 | iter); |
| 465 | if (n != op->downcall.trailer_size) { |
| 466 | gossip_err("%s: failed to copy trailer.\n", __func__); |
| 467 | vfree(op->downcall.trailer_buf); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 468 | goto Efault; |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 469 | } |
| 470 | |
| 471 | wakeup: |
Al Viro | 2a9e5c2 | 2016-01-23 13:45:46 -0500 | [diff] [blame] | 472 | /* |
Mike Marshall | 9f08cfe | 2016-02-26 14:39:08 -0500 | [diff] [blame] | 473 | * Return to vfs waitqueue, and back to service_operation |
| 474 | * through wait_for_matching_downcall. |
Al Viro | 2a9e5c2 | 2016-01-23 13:45:46 -0500 | [diff] [blame] | 475 | */ |
| 476 | spin_lock(&op->lock); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 477 | if (unlikely(op_is_cancel(op))) { |
Al Viro | 2a9e5c2 | 2016-01-23 13:45:46 -0500 | [diff] [blame] | 478 | spin_unlock(&op->lock); |
Al Viro | 78699e2 | 2016-02-11 23:07:19 -0500 | [diff] [blame] | 479 | put_cancel(op); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 480 | } else if (unlikely(op_state_given_up(op))) { |
| 481 | spin_unlock(&op->lock); |
Al Viro | 05a50a5 | 2016-02-18 18:59:44 -0500 | [diff] [blame] | 482 | complete(&op->waitq); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 483 | } else { |
| 484 | set_op_state_serviced(op); |
Mike Marshall | 9d9e7ba | 2016-03-03 13:46:48 -0500 | [diff] [blame] | 485 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 486 | "%s: op:%s: op_state:%d: process:%s:\n", |
| 487 | __func__, |
| 488 | get_opname_string(op), |
| 489 | op->op_state, |
| 490 | current->comm); |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 491 | spin_unlock(&op->lock); |
| 492 | } |
Mike Marshall | b3ae475 | 2016-01-13 11:18:12 -0500 | [diff] [blame] | 493 | return ret; |
Al Viro | ed42fe0 | 2016-01-22 19:47:47 -0500 | [diff] [blame] | 494 | |
Al Viro | 5964c1b | 2016-02-18 18:53:41 -0500 | [diff] [blame] | 495 | Efault: |
| 496 | op->downcall.status = -(ORANGEFS_ERROR_BIT | 9); |
| 497 | ret = -EFAULT; |
| 498 | goto wakeup; |
| 499 | |
| 500 | Enomem: |
| 501 | op->downcall.status = -(ORANGEFS_ERROR_BIT | 8); |
| 502 | ret = -ENOMEM; |
| 503 | goto wakeup; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 504 | } |
| 505 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 506 | /* |
| 507 | * NOTE: gets called when the last reference to this device is dropped. |
| 508 | * Using the open_access_count variable, we enforce a reference count |
| 509 | * on this file so that it can be opened by only one process at a time. |
| 510 | * the devreq_mutex is used to make sure all i/o has completed |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 511 | * before we call orangefs_bufmap_finalize, and similar such tricky |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 512 | * situations |
| 513 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 514 | static int orangefs_devreq_release(struct inode *inode, struct file *file) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 515 | { |
| 516 | int unmounted = 0; |
| 517 | |
| 518 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 519 | "%s:pvfs2-client-core: exiting, closing device\n", |
| 520 | __func__); |
| 521 | |
| 522 | mutex_lock(&devreq_mutex); |
Al Viro | ea2c9c9 | 2016-02-13 21:01:21 -0500 | [diff] [blame] | 523 | orangefs_bufmap_finalize(); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 524 | |
Al Viro | fee25ce | 2016-01-22 19:46:08 -0500 | [diff] [blame] | 525 | open_access_count = -1; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 526 | |
| 527 | unmounted = mark_all_pending_mounts(); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 528 | gossip_debug(GOSSIP_DEV_DEBUG, "ORANGEFS Device Close: Filesystem(s) %s\n", |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 529 | (unmounted ? "UNMOUNTED" : "MOUNTED")); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 530 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 531 | purge_waiting_ops(); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 532 | purge_inprogress_ops(); |
Al Viro | ea2c9c9 | 2016-02-13 21:01:21 -0500 | [diff] [blame] | 533 | |
| 534 | orangefs_bufmap_run_down(); |
| 535 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 536 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 537 | "pvfs2-client-core: device close complete\n"); |
Al Viro | fee25ce | 2016-01-22 19:46:08 -0500 | [diff] [blame] | 538 | open_access_count = 0; |
Martin Brandenburg | f2ee3b7 | 2016-08-09 15:59:26 -0400 | [diff] [blame^] | 539 | userspace_version = 0; |
Al Viro | fee25ce | 2016-01-22 19:46:08 -0500 | [diff] [blame] | 540 | mutex_unlock(&devreq_mutex); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 541 | return 0; |
| 542 | } |
| 543 | |
| 544 | int is_daemon_in_service(void) |
| 545 | { |
| 546 | int in_service; |
| 547 | |
| 548 | /* |
| 549 | * What this function does is checks if client-core is alive |
| 550 | * based on the access count we maintain on the device. |
| 551 | */ |
| 552 | mutex_lock(&devreq_mutex); |
| 553 | in_service = open_access_count == 1 ? 0 : -EIO; |
| 554 | mutex_unlock(&devreq_mutex); |
| 555 | return in_service; |
| 556 | } |
| 557 | |
Al Viro | 78699e2 | 2016-02-11 23:07:19 -0500 | [diff] [blame] | 558 | bool __is_daemon_in_service(void) |
| 559 | { |
| 560 | return open_access_count == 1; |
| 561 | } |
| 562 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 563 | static inline long check_ioctl_command(unsigned int command) |
| 564 | { |
| 565 | /* Check for valid ioctl codes */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 566 | if (_IOC_TYPE(command) != ORANGEFS_DEV_MAGIC) { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 567 | gossip_err("device ioctl magic numbers don't match! Did you rebuild pvfs2-client-core/libpvfs2? [cmd %x, magic %x != %x]\n", |
| 568 | command, |
| 569 | _IOC_TYPE(command), |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 570 | ORANGEFS_DEV_MAGIC); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 571 | return -EINVAL; |
| 572 | } |
| 573 | /* and valid ioctl commands */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 574 | if (_IOC_NR(command) >= ORANGEFS_DEV_MAXNR || _IOC_NR(command) <= 0) { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 575 | gossip_err("Invalid ioctl command number [%d >= %d]\n", |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 576 | _IOC_NR(command), ORANGEFS_DEV_MAXNR); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 577 | return -ENOIOCTLCMD; |
| 578 | } |
| 579 | return 0; |
| 580 | } |
| 581 | |
| 582 | static long dispatch_ioctl_command(unsigned int command, unsigned long arg) |
| 583 | { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 584 | static __s32 magic = ORANGEFS_DEVREQ_MAGIC; |
Martin Brandenburg | a762ae6 | 2015-12-15 14:22:06 -0500 | [diff] [blame] | 585 | static __s32 max_up_size = MAX_DEV_REQ_UPSIZE; |
| 586 | static __s32 max_down_size = MAX_DEV_REQ_DOWNSIZE; |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 587 | struct ORANGEFS_dev_map_desc user_desc; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 588 | int ret = 0; |
| 589 | struct dev_mask_info_s mask_info = { 0 }; |
| 590 | struct dev_mask2_info_s mask2_info = { 0, 0 }; |
| 591 | int upstream_kmod = 1; |
Al Viro | 4599649 | 2016-03-25 19:56:34 -0400 | [diff] [blame] | 592 | struct orangefs_sb_info_s *orangefs_sb; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 593 | |
| 594 | /* mtmoore: add locking here */ |
| 595 | |
| 596 | switch (command) { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 597 | case ORANGEFS_DEV_GET_MAGIC: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 598 | return ((put_user(magic, (__s32 __user *) arg) == -EFAULT) ? |
| 599 | -EIO : |
| 600 | 0); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 601 | case ORANGEFS_DEV_GET_MAX_UPSIZE: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 602 | return ((put_user(max_up_size, |
| 603 | (__s32 __user *) arg) == -EFAULT) ? |
| 604 | -EIO : |
| 605 | 0); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 606 | case ORANGEFS_DEV_GET_MAX_DOWNSIZE: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 607 | return ((put_user(max_down_size, |
| 608 | (__s32 __user *) arg) == -EFAULT) ? |
| 609 | -EIO : |
| 610 | 0); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 611 | case ORANGEFS_DEV_MAP: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 612 | ret = copy_from_user(&user_desc, |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 613 | (struct ORANGEFS_dev_map_desc __user *) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 614 | arg, |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 615 | sizeof(struct ORANGEFS_dev_map_desc)); |
Al Viro | ea2c9c9 | 2016-02-13 21:01:21 -0500 | [diff] [blame] | 616 | /* WTF -EIO and not -EFAULT? */ |
| 617 | return ret ? -EIO : orangefs_bufmap_initialize(&user_desc); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 618 | case ORANGEFS_DEV_REMOUNT_ALL: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 619 | gossip_debug(GOSSIP_DEV_DEBUG, |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 620 | "%s: got ORANGEFS_DEV_REMOUNT_ALL\n", |
| 621 | __func__); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 622 | |
| 623 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 624 | * remount all mounted orangefs volumes to regain the lost |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 625 | * dynamic mount tables (if any) -- NOTE: this is done |
| 626 | * without keeping the superblock list locked due to the |
Mike Marshall | adcf34a | 2016-02-24 16:54:27 -0500 | [diff] [blame] | 627 | * upcall/downcall waiting. also, the request mutex is |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 628 | * used to ensure that no operations will be serviced until |
| 629 | * all of the remounts are serviced (to avoid ops between |
| 630 | * mounts to fail) |
| 631 | */ |
| 632 | ret = mutex_lock_interruptible(&request_mutex); |
| 633 | if (ret < 0) |
| 634 | return ret; |
| 635 | gossip_debug(GOSSIP_DEV_DEBUG, |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 636 | "%s: priority remount in progress\n", |
| 637 | __func__); |
Al Viro | 4599649 | 2016-03-25 19:56:34 -0400 | [diff] [blame] | 638 | spin_lock(&orangefs_superblocks_lock); |
| 639 | list_for_each_entry(orangefs_sb, &orangefs_superblocks, list) { |
| 640 | /* |
| 641 | * We have to drop the spinlock, so entries can be |
| 642 | * removed. They can't be freed, though, so we just |
| 643 | * keep the forward pointers and zero the back ones - |
| 644 | * that way we can get to the rest of the list. |
| 645 | */ |
| 646 | if (!orangefs_sb->list.prev) |
| 647 | continue; |
| 648 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 649 | "%s: Remounting SB %p\n", |
| 650 | __func__, |
| 651 | orangefs_sb); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 652 | |
Al Viro | 4599649 | 2016-03-25 19:56:34 -0400 | [diff] [blame] | 653 | spin_unlock(&orangefs_superblocks_lock); |
| 654 | ret = orangefs_remount(orangefs_sb); |
| 655 | spin_lock(&orangefs_superblocks_lock); |
| 656 | if (ret) { |
| 657 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 658 | "SB %p remount failed\n", |
| 659 | orangefs_sb); |
| 660 | break; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 661 | } |
| 662 | } |
Al Viro | 4599649 | 2016-03-25 19:56:34 -0400 | [diff] [blame] | 663 | spin_unlock(&orangefs_superblocks_lock); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 664 | gossip_debug(GOSSIP_DEV_DEBUG, |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 665 | "%s: priority remount complete\n", |
| 666 | __func__); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 667 | mutex_unlock(&request_mutex); |
| 668 | return ret; |
| 669 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 670 | case ORANGEFS_DEV_UPSTREAM: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 671 | ret = copy_to_user((void __user *)arg, |
| 672 | &upstream_kmod, |
| 673 | sizeof(upstream_kmod)); |
| 674 | |
| 675 | if (ret != 0) |
| 676 | return -EIO; |
| 677 | else |
| 678 | return ret; |
| 679 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 680 | case ORANGEFS_DEV_CLIENT_MASK: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 681 | ret = copy_from_user(&mask2_info, |
| 682 | (void __user *)arg, |
| 683 | sizeof(struct dev_mask2_info_s)); |
| 684 | |
| 685 | if (ret != 0) |
| 686 | return -EIO; |
| 687 | |
| 688 | client_debug_mask.mask1 = mask2_info.mask1_value; |
| 689 | client_debug_mask.mask2 = mask2_info.mask2_value; |
| 690 | |
| 691 | pr_info("%s: client debug mask has been been received " |
| 692 | ":%llx: :%llx:\n", |
| 693 | __func__, |
| 694 | (unsigned long long)client_debug_mask.mask1, |
| 695 | (unsigned long long)client_debug_mask.mask2); |
| 696 | |
| 697 | return ret; |
| 698 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 699 | case ORANGEFS_DEV_CLIENT_STRING: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 700 | ret = copy_from_user(&client_debug_array_string, |
| 701 | (void __user *)arg, |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 702 | ORANGEFS_MAX_DEBUG_STRING_LEN); |
Mike Marshall | 53f57fe | 2016-03-14 15:28:34 -0400 | [diff] [blame] | 703 | /* |
| 704 | * The real client-core makes an effort to ensure |
| 705 | * that actual strings that aren't too long to fit in |
| 706 | * this buffer is what we get here. We're going to use |
| 707 | * string functions on the stuff we got, so we'll make |
| 708 | * this extra effort to try and keep from |
| 709 | * flowing out of this buffer when we use the string |
| 710 | * functions, even if somehow the stuff we end up |
| 711 | * with here is garbage. |
| 712 | */ |
| 713 | client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] = |
| 714 | '\0'; |
| 715 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 716 | if (ret != 0) { |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 717 | pr_info("%s: CLIENT_STRING: copy_from_user failed\n", |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 718 | __func__); |
| 719 | return -EIO; |
| 720 | } |
| 721 | |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 722 | pr_info("%s: client debug array string has been received.\n", |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 723 | __func__); |
| 724 | |
| 725 | if (!help_string_initialized) { |
| 726 | |
| 727 | /* Free the "we don't know yet" default string... */ |
| 728 | kfree(debug_help_string); |
| 729 | |
| 730 | /* build a proper debug help string */ |
| 731 | if (orangefs_prepare_debugfs_help_string(0)) { |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 732 | gossip_err("%s: no debug help string \n", |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 733 | __func__); |
| 734 | return -EIO; |
| 735 | } |
| 736 | |
| 737 | /* Replace the boilerplate boot-time debug-help file. */ |
| 738 | debugfs_remove(help_file_dentry); |
| 739 | |
| 740 | help_file_dentry = |
| 741 | debugfs_create_file( |
| 742 | ORANGEFS_KMOD_DEBUG_HELP_FILE, |
| 743 | 0444, |
| 744 | debug_dir, |
| 745 | debug_help_string, |
| 746 | &debug_help_fops); |
| 747 | |
| 748 | if (!help_file_dentry) { |
| 749 | gossip_err("%s: debugfs_create_file failed for" |
| 750 | " :%s:!\n", |
| 751 | __func__, |
| 752 | ORANGEFS_KMOD_DEBUG_HELP_FILE); |
| 753 | return -EIO; |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | debug_mask_to_string(&client_debug_mask, 1); |
| 758 | |
| 759 | debugfs_remove(client_debug_dentry); |
| 760 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 761 | orangefs_client_debug_init(); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 762 | |
| 763 | help_string_initialized++; |
| 764 | |
| 765 | return ret; |
| 766 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 767 | case ORANGEFS_DEV_DEBUG: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 768 | ret = copy_from_user(&mask_info, |
| 769 | (void __user *)arg, |
| 770 | sizeof(mask_info)); |
| 771 | |
| 772 | if (ret != 0) |
| 773 | return -EIO; |
| 774 | |
| 775 | if (mask_info.mask_type == KERNEL_MASK) { |
| 776 | if ((mask_info.mask_value == 0) |
| 777 | && (kernel_mask_set_mod_init)) { |
| 778 | /* |
| 779 | * the kernel debug mask was set when the |
| 780 | * kernel module was loaded; don't override |
| 781 | * it if the client-core was started without |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 782 | * a value for ORANGEFS_KMODMASK. |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 783 | */ |
| 784 | return 0; |
| 785 | } |
| 786 | debug_mask_to_string(&mask_info.mask_value, |
| 787 | mask_info.mask_type); |
| 788 | gossip_debug_mask = mask_info.mask_value; |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 789 | pr_info("%s: kernel debug mask has been modified to " |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 790 | ":%s: :%llx:\n", |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 791 | __func__, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 792 | kernel_debug_string, |
| 793 | (unsigned long long)gossip_debug_mask); |
| 794 | } else if (mask_info.mask_type == CLIENT_MASK) { |
| 795 | debug_mask_to_string(&mask_info.mask_value, |
| 796 | mask_info.mask_type); |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 797 | pr_info("%s: client debug mask has been modified to" |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 798 | ":%s: :%llx:\n", |
Mike Marshall | 97f1002 | 2015-12-11 16:45:03 -0500 | [diff] [blame] | 799 | __func__, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 800 | client_debug_string, |
| 801 | llu(mask_info.mask_value)); |
| 802 | } else { |
| 803 | gossip_lerr("Invalid mask type....\n"); |
| 804 | return -EINVAL; |
| 805 | } |
| 806 | |
| 807 | return ret; |
| 808 | |
| 809 | default: |
| 810 | return -ENOIOCTLCMD; |
| 811 | } |
| 812 | return -ENOIOCTLCMD; |
| 813 | } |
| 814 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 815 | static long orangefs_devreq_ioctl(struct file *file, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 816 | unsigned int command, unsigned long arg) |
| 817 | { |
| 818 | long ret; |
| 819 | |
| 820 | /* Check for properly constructed commands */ |
| 821 | ret = check_ioctl_command(command); |
| 822 | if (ret < 0) |
| 823 | return (int)ret; |
| 824 | |
| 825 | return (int)dispatch_ioctl_command(command, arg); |
| 826 | } |
| 827 | |
| 828 | #ifdef CONFIG_COMPAT /* CONFIG_COMPAT is in .config */ |
| 829 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 830 | /* Compat structure for the ORANGEFS_DEV_MAP ioctl */ |
| 831 | struct ORANGEFS_dev_map_desc32 { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 832 | compat_uptr_t ptr; |
| 833 | __s32 total_size; |
| 834 | __s32 size; |
| 835 | __s32 count; |
| 836 | }; |
| 837 | |
| 838 | static unsigned long translate_dev_map26(unsigned long args, long *error) |
| 839 | { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 840 | struct ORANGEFS_dev_map_desc32 __user *p32 = (void __user *)args; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 841 | /* |
| 842 | * Depending on the architecture, allocate some space on the |
| 843 | * user-call-stack based on our expected layout. |
| 844 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 845 | struct ORANGEFS_dev_map_desc __user *p = |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 846 | compat_alloc_user_space(sizeof(*p)); |
Mike Marshall | 84d0215 | 2015-07-28 13:27:51 -0400 | [diff] [blame] | 847 | compat_uptr_t addr; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 848 | |
| 849 | *error = 0; |
| 850 | /* get the ptr from the 32 bit user-space */ |
| 851 | if (get_user(addr, &p32->ptr)) |
| 852 | goto err; |
| 853 | /* try to put that into a 64-bit layout */ |
| 854 | if (put_user(compat_ptr(addr), &p->ptr)) |
| 855 | goto err; |
| 856 | /* copy the remaining fields */ |
| 857 | if (copy_in_user(&p->total_size, &p32->total_size, sizeof(__s32))) |
| 858 | goto err; |
| 859 | if (copy_in_user(&p->size, &p32->size, sizeof(__s32))) |
| 860 | goto err; |
| 861 | if (copy_in_user(&p->count, &p32->count, sizeof(__s32))) |
| 862 | goto err; |
| 863 | return (unsigned long)p; |
| 864 | err: |
| 865 | *error = -EFAULT; |
| 866 | return 0; |
| 867 | } |
| 868 | |
| 869 | /* |
| 870 | * 32 bit user-space apps' ioctl handlers when kernel modules |
| 871 | * is compiled as a 64 bit one |
| 872 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 873 | static long orangefs_devreq_compat_ioctl(struct file *filp, unsigned int cmd, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 874 | unsigned long args) |
| 875 | { |
| 876 | long ret; |
| 877 | unsigned long arg = args; |
| 878 | |
| 879 | /* Check for properly constructed commands */ |
| 880 | ret = check_ioctl_command(cmd); |
| 881 | if (ret < 0) |
| 882 | return ret; |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 883 | if (cmd == ORANGEFS_DEV_MAP) { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 884 | /* |
| 885 | * convert the arguments to what we expect internally |
| 886 | * in kernel space |
| 887 | */ |
| 888 | arg = translate_dev_map26(args, &ret); |
| 889 | if (ret < 0) { |
| 890 | gossip_err("Could not translate dev map\n"); |
| 891 | return ret; |
| 892 | } |
| 893 | } |
| 894 | /* no other ioctl requires translation */ |
| 895 | return dispatch_ioctl_command(cmd, arg); |
| 896 | } |
| 897 | |
Mike Marshall | 2c590d5 | 2015-07-24 10:37:15 -0400 | [diff] [blame] | 898 | #endif /* CONFIG_COMPAT is in .config */ |
| 899 | |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 900 | /* the assigned character device major number */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 901 | static int orangefs_dev_major; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 902 | |
| 903 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 904 | * Initialize orangefs device specific state: |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 905 | * Must be called at module load time only |
| 906 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 907 | int orangefs_dev_init(void) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 908 | { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 909 | /* register orangefs-req device */ |
| 910 | orangefs_dev_major = register_chrdev(0, |
| 911 | ORANGEFS_REQDEVICE_NAME, |
| 912 | &orangefs_devreq_file_operations); |
| 913 | if (orangefs_dev_major < 0) { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 914 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 915 | "Failed to register /dev/%s (error %d)\n", |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 916 | ORANGEFS_REQDEVICE_NAME, orangefs_dev_major); |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 917 | return orangefs_dev_major; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 918 | } |
| 919 | |
| 920 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 921 | "*** /dev/%s character device registered ***\n", |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 922 | ORANGEFS_REQDEVICE_NAME); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 923 | gossip_debug(GOSSIP_DEV_DEBUG, "'mknod /dev/%s c %d 0'.\n", |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 924 | ORANGEFS_REQDEVICE_NAME, orangefs_dev_major); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 925 | return 0; |
| 926 | } |
| 927 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 928 | void orangefs_dev_cleanup(void) |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 929 | { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 930 | unregister_chrdev(orangefs_dev_major, ORANGEFS_REQDEVICE_NAME); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 931 | gossip_debug(GOSSIP_DEV_DEBUG, |
| 932 | "*** /dev/%s character device unregistered ***\n", |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 933 | ORANGEFS_REQDEVICE_NAME); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 934 | } |
| 935 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 936 | static unsigned int orangefs_devreq_poll(struct file *file, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 937 | struct poll_table_struct *poll_table) |
| 938 | { |
| 939 | int poll_revent_mask = 0; |
| 940 | |
Al Viro | 83595db | 2016-01-19 12:03:05 -0500 | [diff] [blame] | 941 | poll_wait(file, &orangefs_request_list_waitq, poll_table); |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 942 | |
Al Viro | 83595db | 2016-01-19 12:03:05 -0500 | [diff] [blame] | 943 | if (!list_empty(&orangefs_request_list)) |
| 944 | poll_revent_mask |= POLL_IN; |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 945 | return poll_revent_mask; |
| 946 | } |
| 947 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 948 | const struct file_operations orangefs_devreq_file_operations = { |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 949 | .owner = THIS_MODULE, |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 950 | .read = orangefs_devreq_read, |
| 951 | .write_iter = orangefs_devreq_write_iter, |
| 952 | .open = orangefs_devreq_open, |
| 953 | .release = orangefs_devreq_release, |
| 954 | .unlocked_ioctl = orangefs_devreq_ioctl, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 955 | |
| 956 | #ifdef CONFIG_COMPAT /* CONFIG_COMPAT is in .config */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 957 | .compat_ioctl = orangefs_devreq_compat_ioctl, |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 958 | #endif |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 959 | .poll = orangefs_devreq_poll |
Mike Marshall | 5db11c2 | 2015-07-17 10:38:12 -0400 | [diff] [blame] | 960 | }; |