Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '9p-for-7.1-rc1' of https://github.com/martinetd/linux

Pull 9p updates from Dominique Martinet:

- 9p access flag fix (cannot change access flag since new mount API implem)

- some minor cleanup

* tag '9p-for-7.1-rc1' of https://github.com/martinetd/linux:
9p/trans_xen: replace simple_strto* with kstrtouint
9p/trans_xen: make cleanup idempotent after dataring alloc errors
9p: document missing enum values in kernel-doc comments
9p: fix access mode flags being ORed instead of replaced
9p: fix memory leak in v9fs_init_fs_context error path

+95 -30
+4
fs/9p/v9fs.c
··· 413 413 /* 414 414 * Note that we must |= flags here as session_init already 415 415 * set basic flags. This adds in flags from parsed options. 416 + * Default access flags must be cleared if session options 417 + * changes them to avoid mangling the setting. 416 418 */ 419 + if (ctx->session_opts.flags & V9FS_ACCESS_MASK) 420 + v9ses->flags &= ~V9FS_ACCESS_MASK; 417 421 v9ses->flags |= ctx->session_opts.flags; 418 422 #ifdef CONFIG_9P_FSCACHE 419 423 v9ses->cachetag = ctx->session_opts.cachetag;
+3 -3
fs/9p/vfs_super.c
··· 312 312 if (!ctx) 313 313 return -ENOMEM; 314 314 315 + fc->ops = &v9fs_context_ops; 316 + fc->fs_private = ctx; 317 + 315 318 /* initialize core options */ 316 319 ctx->session_opts.afid = ~0; 317 320 ctx->session_opts.cache = CACHE_NONE; ··· 347 344 ctx->rdma_opts.rq_depth = P9_RDMA_RQ_DEPTH; 348 345 ctx->rdma_opts.timeout = P9_RDMA_TIMEOUT; 349 346 ctx->rdma_opts.privport = false; 350 - 351 - fc->ops = &v9fs_context_ops; 352 - fc->fs_private = ctx; 353 347 354 348 return 0; 355 349 error:
+35 -3
include/net/9p/9p.h
··· 24 24 * @P9_DEBUG_PKT: packet marshalling/unmarshalling 25 25 * @P9_DEBUG_FSC: FS-cache tracing 26 26 * @P9_DEBUG_VPKT: Verbose packet debugging (full packet dump) 27 + * @P9_DEBUG_CACHE: cache operations tracing 28 + * @P9_DEBUG_MMAP: memory-mapped I/O tracing 27 29 * 28 30 * These flags are passed at mount time to turn on various levels of 29 31 * verbosity and tracing which will be output to the system logs. ··· 70 68 * @P9_RSYMLINK: make symlink response 71 69 * @P9_TMKNOD: create a special file object request 72 70 * @P9_RMKNOD: create a special file object response 71 + * @P9_TLOPEN: open a file for I/O (9P2000.L) 72 + * @P9_RLOPEN: response with qid and iounit (9P2000.L) 73 73 * @P9_TLCREATE: prepare a handle for I/O on an new file for 9P2000.L 74 74 * @P9_RLCREATE: response with file access information for 9P2000.L 75 75 * @P9_TRENAME: rename request 76 76 * @P9_RRENAME: rename response 77 - * @P9_TMKDIR: create a directory request 78 - * @P9_RMKDIR: create a directory response 79 - * @P9_TVERSION: version handshake request 77 + * @P9_TREADLINK: read symbolic link target (9P2000.L) 78 + * @P9_RREADLINK: response with symbolic link target (9P2000.L) 79 + * @P9_TGETATTR: get file attributes request (9P2000.L) 80 + * @P9_RGETATTR: get file attributes response (9P2000.L) 81 + * @P9_TSETATTR: set file attributes request (9P2000.L) 82 + * @P9_RSETATTR: set file attributes response (9P2000.L) 83 + * @P9_TXATTRWALK: prepare to read/list extended attributes (9P2000.L) 84 + * @P9_RXATTRWALK: response with extended attribute size (9P2000.L) 85 + * @P9_TXATTRCREATE: prepare to set extended attribute (9P2000.L) 86 + * @P9_RXATTRCREATE: set extended attribute response (9P2000.L) 87 + * @P9_TREADDIR: read directory entries request (9P2000.L) 88 + * @P9_RREADDIR: read directory entries response (9P2000.L) 89 + * @P9_TFSYNC: flush cached file data to storage request (9P2000.L) 90 + * @P9_RFSYNC: flush cached file data to storage response (9P2000.L) 91 + * @P9_TLOCK: acquire or release a POSIX record lock (9P2000.L) 92 + * @P9_RLOCK: POSIX record lock response (9P2000.L) 93 + * @P9_TGETLOCK: test for existence of POSIX record lock (9P2000.L) 94 + * @P9_RGETLOCK: POSIX record lock test response (9P2000.L) 95 + * @P9_TLINK: create a hard link (9P2000.L) 96 + * @P9_RLINK: hard link response (9P2000.L) 97 + * @P9_TRENAMEAT: safely rename across directories (9P2000.L) 98 + * @P9_RRENAMEAT: rename response (9P2000.L) 99 + * @P9_TUNLINKAT: unlink a file or directory (9P2000.L) 100 + * @P9_RUNLINKAT: unlink response (9P2000.L) 101 + * @P9_TMKDIR: create a directory request (9P2000.L) 102 + * @P9_RMKDIR: create a directory response (9P2000.L) 103 + * @P9_TVERSION: negotiate protocol version and message size 80 104 * @P9_RVERSION: version handshake response 81 105 * @P9_TAUTH: request to establish authentication channel 82 106 * @P9_RAUTH: response with authentication information ··· 222 194 * @P9_ORCLOSE: remove the file when the file is closed 223 195 * @P9_OAPPEND: open the file and seek to the end 224 196 * @P9_OEXCL: only create a file, do not open it 197 + * @P9L_MODE_MASK: mask for protocol mode bits (client-side only) 198 + * @P9L_DIRECT: disable client-side caching for this file 199 + * @P9L_NOWRITECACHE: disable write caching for this file 200 + * @P9L_LOOSE: enable loose cache consistency 225 201 * 226 202 * 9P open modes differ slightly from Posix standard modes. 227 203 * In particular, there are extra modes which specify different
+53 -24
net/9p/trans_xen.c
··· 283 283 284 284 cancel_work_sync(&ring->work); 285 285 286 - if (!priv->rings[i].intf) 286 + if (!ring->intf) 287 287 break; 288 - if (priv->rings[i].irq > 0) 289 - unbind_from_irqhandler(priv->rings[i].irq, ring); 290 - if (priv->rings[i].data.in) { 291 - for (j = 0; 292 - j < (1 << priv->rings[i].intf->ring_order); 288 + if (ring->irq >= 0) { 289 + unbind_from_irqhandler(ring->irq, ring); 290 + ring->irq = -1; 291 + } 292 + if (ring->data.in) { 293 + for (j = 0; j < (1 << ring->intf->ring_order); 293 294 j++) { 294 295 grant_ref_t ref; 295 296 296 - ref = priv->rings[i].intf->ref[j]; 297 + ref = ring->intf->ref[j]; 297 298 gnttab_end_foreign_access(ref, NULL); 299 + ring->intf->ref[j] = INVALID_GRANT_REF; 298 300 } 299 - free_pages_exact(priv->rings[i].data.in, 300 - 1UL << (priv->rings[i].intf->ring_order + 301 - XEN_PAGE_SHIFT)); 301 + free_pages_exact(ring->data.in, 302 + 1UL << (ring->intf->ring_order + 303 + XEN_PAGE_SHIFT)); 304 + ring->data.in = NULL; 305 + ring->data.out = NULL; 302 306 } 303 - gnttab_end_foreign_access(priv->rings[i].ref, NULL); 304 - free_page((unsigned long)priv->rings[i].intf); 307 + if (ring->ref != INVALID_GRANT_REF) { 308 + gnttab_end_foreign_access(ring->ref, NULL); 309 + ring->ref = INVALID_GRANT_REF; 310 + } 311 + free_page((unsigned long)ring->intf); 312 + ring->intf = NULL; 305 313 } 306 314 kfree(priv->rings); 307 315 } ··· 341 333 int i = 0; 342 334 int ret = -ENOMEM; 343 335 void *bytes = NULL; 336 + 337 + ring->intf = NULL; 338 + ring->data.in = NULL; 339 + ring->data.out = NULL; 340 + ring->ref = INVALID_GRANT_REF; 341 + ring->irq = -1; 344 342 345 343 init_waitqueue_head(&ring->wq); 346 344 spin_lock_init(&ring->lock); ··· 393 379 for (i--; i >= 0; i--) 394 380 gnttab_end_foreign_access(ring->intf->ref[i], NULL); 395 381 free_pages_exact(bytes, 1UL << (order + XEN_PAGE_SHIFT)); 382 + ring->data.in = NULL; 383 + ring->data.out = NULL; 396 384 } 397 - gnttab_end_foreign_access(ring->ref, NULL); 398 - free_page((unsigned long)ring->intf); 385 + if (ring->ref != INVALID_GRANT_REF) { 386 + gnttab_end_foreign_access(ring->ref, NULL); 387 + ring->ref = INVALID_GRANT_REF; 388 + } 389 + if (ring->intf) { 390 + free_page((unsigned long)ring->intf); 391 + ring->intf = NULL; 392 + } 393 + ring->irq = -1; 399 394 return ret; 400 395 } 401 396 ··· 413 390 int ret, i; 414 391 struct xenbus_transaction xbt; 415 392 struct xen_9pfs_front_priv *priv; 416 - char *versions, *v; 417 - unsigned int max_rings, max_ring_order, len = 0; 393 + char *versions, *v, *token; 394 + bool version_1 = false; 395 + unsigned int max_rings, max_ring_order, len = 0, version; 418 396 419 397 versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len); 420 398 if (IS_ERR(versions)) 421 399 return PTR_ERR(versions); 422 - for (v = versions; *v; v++) { 423 - if (simple_strtoul(v, &v, 10) == 1) { 424 - v = NULL; 425 - break; 400 + for (v = versions; (token = strsep(&v, ",")); ) { 401 + if (!*token) 402 + continue; 403 + 404 + ret = kstrtouint(token, 10, &version); 405 + if (ret) { 406 + kfree(versions); 407 + return ret; 426 408 } 427 - } 428 - if (v) { 429 - kfree(versions); 430 - return -EINVAL; 409 + if (version == 1) 410 + version_1 = true; 431 411 } 432 412 kfree(versions); 413 + if (!version_1) 414 + return -EINVAL; 415 + 433 416 max_rings = xenbus_read_unsigned(dev->otherend, "max-rings", 0); 434 417 if (max_rings < XEN_9PFS_NUM_RINGS) 435 418 return -EINVAL;