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

Merge tag '9p-6.3-for-linus-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

Pull 9p updates from Eric Van Hensbergen:

- some fixes and cleanup setting up for a larger set of performance
patches I've been working on

- a contributed fixes relating to 9p/rdma

- some contributed fixes relating to 9p/xen

* tag '9p-6.3-for-linus-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
fs/9p: fix error reporting in v9fs_dir_release
net/9p: fix bug in client create for .L
9p/rdma: unmap receive dma buffer in rdma_request()/post_recv()
9p/xen: fix connection sequence
9p/xen: fix version parsing
fs/9p: Expand setup of writeback cache to all levels
net/9p: Adjust maximum MSIZE to account for p9 header

+63 -36
+1 -1
fs/9p/v9fs.c
··· 468 468 469 469 #ifdef CONFIG_9P_FSCACHE 470 470 /* register the session for caching */ 471 - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 471 + if (v9ses->cache == CACHE_FSCACHE) { 472 472 rc = v9fs_cache_session_get_cookie(v9ses, dev_name); 473 473 if (rc < 0) 474 474 goto err_clnt;
-2
fs/9p/vfs_addr.c
··· 279 279 280 280 p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping); 281 281 282 - BUG_ON(!v9inode->writeback_fid); 283 - 284 282 /* Prefetch area to be written into the cache if we're caching this 285 283 * file. We need to do this before we get a lock on the page in case 286 284 * there's more than one writer competing for the same cache block.
+4 -3
fs/9p/vfs_dir.c
··· 197 197 198 198 199 199 /** 200 - * v9fs_dir_release - close a directory 200 + * v9fs_dir_release - called on a close of a file or directory 201 201 * @inode: inode of the directory 202 202 * @filp: file pointer to a directory 203 203 * ··· 209 209 struct p9_fid *fid; 210 210 __le32 version; 211 211 loff_t i_size; 212 + int retval = 0; 212 213 213 214 fid = filp->private_data; 214 215 p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n", ··· 218 217 spin_lock(&inode->i_lock); 219 218 hlist_del(&fid->ilist); 220 219 spin_unlock(&inode->i_lock); 221 - p9_fid_put(fid); 220 + retval = p9_fid_put(fid); 222 221 } 223 222 224 223 if ((filp->f_mode & FMODE_WRITE)) { ··· 229 228 } else { 230 229 fscache_unuse_cookie(v9fs_inode_cookie(v9inode), NULL, NULL); 231 230 } 232 - return 0; 231 + return retval; 233 232 } 234 233 235 234 const struct file_operations v9fs_dir_operations = {
+4 -3
fs/9p/vfs_file.c
··· 74 74 } 75 75 76 76 mutex_lock(&v9inode->v_mutex); 77 - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && 78 - !v9inode->writeback_fid && 77 + if ((v9ses->cache) && !v9inode->writeback_fid && 79 78 ((file->f_flags & O_ACCMODE) != O_RDONLY)) { 80 79 /* 81 80 * clone a fid and add it to writeback_fid ··· 92 93 v9inode->writeback_fid = (void *) writeback_fid; 93 94 } 94 95 mutex_unlock(&v9inode->v_mutex); 95 - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) 96 + #ifdef CONFIG_9P_FSCACHE 97 + if (v9ses->cache == CACHE_FSCACHE) 96 98 fscache_use_cookie(v9fs_inode_cookie(v9inode), 97 99 file->f_mode & FMODE_WRITE); 100 + #endif 98 101 v9fs_open_fid_add(inode, &fid); 99 102 return 0; 100 103 out_error:
+1 -2
fs/9p/vfs_inode.c
··· 843 843 inode = d_inode(dentry); 844 844 v9inode = V9FS_I(inode); 845 845 mutex_lock(&v9inode->v_mutex); 846 - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && 847 - !v9inode->writeback_fid && 846 + if ((v9ses->cache) && !v9inode->writeback_fid && 848 847 ((flags & O_ACCMODE) != O_RDONLY)) { 849 848 /* 850 849 * clone a fid and add it to writeback_fid
+4 -3
fs/9p/vfs_inode_dotl.c
··· 316 316 317 317 v9inode = V9FS_I(inode); 318 318 mutex_lock(&v9inode->v_mutex); 319 - if ((v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) && 320 - !v9inode->writeback_fid && 319 + if ((v9ses->cache) && !v9inode->writeback_fid && 321 320 ((flags & O_ACCMODE) != O_RDONLY)) { 322 321 /* 323 322 * clone a fid and add it to writeback_fid ··· 339 340 if (err) 340 341 goto out; 341 342 file->private_data = ofid; 342 - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) 343 + #ifdef CONFIG_9P_FSCACHE 344 + if (v9ses->cache == CACHE_FSCACHE) 343 345 fscache_use_cookie(v9fs_inode_cookie(v9inode), 344 346 file->f_mode & FMODE_WRITE); 347 + #endif 345 348 v9fs_open_fid_add(inode, &ofid); 346 349 file->f_mode |= FMODE_CREATED; 347 350 out:
+6 -2
net/9p/client.c
··· 28 28 #define CREATE_TRACE_POINTS 29 29 #include <trace/events/9p.h> 30 30 31 - #define DEFAULT_MSIZE (128 * 1024) 31 + /* DEFAULT MSIZE = 32 pages worth of payload + P9_HDRSZ + 32 + * room for write (16 extra) or read (11 extra) operands. 33 + */ 34 + 35 + #define DEFAULT_MSIZE ((128 * 1024) + P9_IOHDRSZ) 32 36 33 37 /* Client Option Parsing (code inspired by NFS code) 34 38 * - a little lazy - parse all client options ··· 1293 1289 qid->type, qid->path, qid->version, iounit); 1294 1290 1295 1291 memmove(&ofid->qid, qid, sizeof(struct p9_qid)); 1296 - ofid->mode = mode; 1292 + ofid->mode = flags; 1297 1293 ofid->iounit = iounit; 1298 1294 1299 1295 free_and_error:
+12 -3
net/9p/trans_rdma.c
··· 385 385 struct p9_trans_rdma *rdma = client->trans; 386 386 struct ib_recv_wr wr; 387 387 struct ib_sge sge; 388 + int ret; 388 389 389 390 c->busa = ib_dma_map_single(rdma->cm_id->device, 390 391 c->rc.sdata, client->msize, ··· 403 402 wr.wr_cqe = &c->cqe; 404 403 wr.sg_list = &sge; 405 404 wr.num_sge = 1; 406 - return ib_post_recv(rdma->qp, &wr, NULL); 405 + 406 + ret = ib_post_recv(rdma->qp, &wr, NULL); 407 + if (ret) 408 + ib_dma_unmap_single(rdma->cm_id->device, c->busa, 409 + client->msize, DMA_FROM_DEVICE); 410 + return ret; 407 411 408 412 error: 409 413 p9_debug(P9_DEBUG_ERROR, "EIO\n"); ··· 505 499 506 500 if (down_interruptible(&rdma->sq_sem)) { 507 501 err = -EINTR; 508 - goto send_error; 502 + goto dma_unmap; 509 503 } 510 504 511 505 /* Mark request as `sent' *before* we actually send it, ··· 515 509 WRITE_ONCE(req->status, REQ_STATUS_SENT); 516 510 err = ib_post_send(rdma->qp, &wr, NULL); 517 511 if (err) 518 - goto send_error; 512 + goto dma_unmap; 519 513 520 514 /* Success */ 521 515 return 0; 522 516 517 + dma_unmap: 518 + ib_dma_unmap_single(rdma->cm_id->device, c->busa, 519 + c->req->tc.size, DMA_TO_DEVICE); 523 520 /* Handle errors that happened during or while preparing the send: */ 524 521 send_error: 525 522 WRITE_ONCE(req->status, REQ_STATUS_ERROR);
+31 -17
net/9p/trans_xen.c
··· 372 372 return ret; 373 373 } 374 374 375 - static int xen_9pfs_front_probe(struct xenbus_device *dev, 376 - const struct xenbus_device_id *id) 375 + static int xen_9pfs_front_init(struct xenbus_device *dev) 377 376 { 378 377 int ret, i; 379 378 struct xenbus_transaction xbt; 380 - struct xen_9pfs_front_priv *priv = NULL; 381 - char *versions; 379 + struct xen_9pfs_front_priv *priv = dev_get_drvdata(&dev->dev); 380 + char *versions, *v; 382 381 unsigned int max_rings, max_ring_order, len = 0; 383 382 384 383 versions = xenbus_read(XBT_NIL, dev->otherend, "versions", &len); 385 384 if (IS_ERR(versions)) 386 385 return PTR_ERR(versions); 387 - if (strcmp(versions, "1")) { 386 + for (v = versions; *v; v++) { 387 + if (simple_strtoul(v, &v, 10) == 1) { 388 + v = NULL; 389 + break; 390 + } 391 + } 392 + if (v) { 388 393 kfree(versions); 389 394 return -EINVAL; 390 395 } ··· 404 399 if (p9_xen_trans.maxsize > XEN_FLEX_RING_SIZE(max_ring_order)) 405 400 p9_xen_trans.maxsize = XEN_FLEX_RING_SIZE(max_ring_order) / 2; 406 401 407 - priv = kzalloc(sizeof(*priv), GFP_KERNEL); 408 - if (!priv) 409 - return -ENOMEM; 410 - 411 - priv->dev = dev; 412 402 priv->num_rings = XEN_9PFS_NUM_RINGS; 413 403 priv->rings = kcalloc(priv->num_rings, sizeof(*priv->rings), 414 404 GFP_KERNEL); ··· 462 462 goto error; 463 463 } 464 464 465 - write_lock(&xen_9pfs_lock); 466 - list_add_tail(&priv->list, &xen_9pfs_devs); 467 - write_unlock(&xen_9pfs_lock); 468 - dev_set_drvdata(&dev->dev, priv); 469 - xenbus_switch_state(dev, XenbusStateInitialised); 470 - 471 465 return 0; 472 466 473 467 error_xenbus: 474 468 xenbus_transaction_end(xbt, 1); 475 469 xenbus_dev_fatal(dev, ret, "writing xenstore"); 476 470 error: 477 - dev_set_drvdata(&dev->dev, NULL); 478 471 xen_9pfs_front_free(priv); 479 472 return ret; 473 + } 474 + 475 + static int xen_9pfs_front_probe(struct xenbus_device *dev, 476 + const struct xenbus_device_id *id) 477 + { 478 + struct xen_9pfs_front_priv *priv = NULL; 479 + 480 + priv = kzalloc(sizeof(*priv), GFP_KERNEL); 481 + if (!priv) 482 + return -ENOMEM; 483 + 484 + priv->dev = dev; 485 + dev_set_drvdata(&dev->dev, priv); 486 + 487 + write_lock(&xen_9pfs_lock); 488 + list_add_tail(&priv->list, &xen_9pfs_devs); 489 + write_unlock(&xen_9pfs_lock); 490 + 491 + return 0; 480 492 } 481 493 482 494 static int xen_9pfs_front_resume(struct xenbus_device *dev) ··· 509 497 break; 510 498 511 499 case XenbusStateInitWait: 500 + if (!xen_9pfs_front_init(dev)) 501 + xenbus_switch_state(dev, XenbusStateInitialised); 512 502 break; 513 503 514 504 case XenbusStateConnected: