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-5.7' of git://github.com/martinetd/linux

Pull 9p updates from Dominique Martinet:
"Not much new, but a few patches for this cycle:

- Fix read with O_NONBLOCK to allow incomplete read and return
immediately

- Rest is just cleanup (indent, unused field in struct, extra
semicolon)"

* tag '9p-for-5.7' of git://github.com/martinetd/linux:
net/9p: remove unused p9_req_t aux field
9p: read only once on O_NONBLOCK
9pnet: allow making incomplete read requests
9p: Remove unneeded semicolon
9p: Fix Kconfig indentation

+94 -79
+9 -9
fs/9p/Kconfig
··· 32 32 33 33 34 34 config 9P_FS_SECURITY 35 - bool "9P Security Labels" 36 - depends on 9P_FS 37 - help 38 - Security labels support alternative access control models 39 - implemented by security modules like SELinux. This option 40 - enables an extended attribute handler for file security 41 - labels in the 9P filesystem. 35 + bool "9P Security Labels" 36 + depends on 9P_FS 37 + help 38 + Security labels support alternative access control models 39 + implemented by security modules like SELinux. This option 40 + enables an extended attribute handler for file security 41 + labels in the 9P filesystem. 42 42 43 - If you are not using a security module that requires using 44 - extended attributes for file security labels, say N. 43 + If you are not using a security module that requires using 44 + extended attributes for file security labels, say N.
+4 -1
fs/9p/vfs_file.c
··· 388 388 p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n", 389 389 iov_iter_count(to), iocb->ki_pos); 390 390 391 - ret = p9_client_read(fid, iocb->ki_pos, to, &err); 391 + if (iocb->ki_filp->f_flags & O_NONBLOCK) 392 + ret = p9_client_read_once(fid, iocb->ki_pos, to, &err); 393 + else 394 + ret = p9_client_read(fid, iocb->ki_pos, to, &err); 392 395 if (!ret) 393 396 return err; 394 397
+1 -1
fs/9p/vfs_inode.c
··· 143 143 default: 144 144 p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n", 145 145 type, stat->extension); 146 - }; 146 + } 147 147 *rdev = MKDEV(major, minor); 148 148 } else 149 149 res |= S_IFREG;
+2 -2
include/net/9p/client.h
··· 73 73 * @wq: wait_queue for the client to block on for this request 74 74 * @tc: the request fcall structure 75 75 * @rc: the response fcall structure 76 - * @aux: transport specific data (provided for trans_fd migration) 77 76 * @req_list: link for higher level objects to chain requests 78 77 */ 79 78 struct p9_req_t { ··· 82 83 wait_queue_head_t wq; 83 84 struct p9_fcall tc; 84 85 struct p9_fcall rc; 85 - void *aux; 86 86 struct list_head req_list; 87 87 }; 88 88 ··· 198 200 int p9_client_remove(struct p9_fid *fid); 199 201 int p9_client_unlinkat(struct p9_fid *dfid, const char *name, int flags); 200 202 int p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err); 203 + int p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to, 204 + int *err); 201 205 int p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err); 202 206 int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset); 203 207 int p9dirent_read(struct p9_client *clnt, char *buf, int len,
+78 -66
net/9p/client.c
··· 1549 1549 int 1550 1550 p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err) 1551 1551 { 1552 - struct p9_client *clnt = fid->clnt; 1553 - struct p9_req_t *req; 1554 1552 int total = 0; 1555 1553 *err = 0; 1556 1554 1557 - p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n", 1558 - fid->fid, (unsigned long long) offset, (int)iov_iter_count(to)); 1559 - 1560 1555 while (iov_iter_count(to)) { 1561 - int count = iov_iter_count(to); 1562 - int rsize, non_zc = 0; 1563 - char *dataptr; 1556 + int count; 1564 1557 1565 - rsize = fid->iounit; 1566 - if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) 1567 - rsize = clnt->msize - P9_IOHDRSZ; 1568 - 1569 - if (count < rsize) 1570 - rsize = count; 1571 - 1572 - /* Don't bother zerocopy for small IO (< 1024) */ 1573 - if (clnt->trans_mod->zc_request && rsize > 1024) { 1574 - /* 1575 - * response header len is 11 1576 - * PDU Header(7) + IO Size (4) 1577 - */ 1578 - req = p9_client_zc_rpc(clnt, P9_TREAD, to, NULL, rsize, 1579 - 0, 11, "dqd", fid->fid, 1580 - offset, rsize); 1581 - } else { 1582 - non_zc = 1; 1583 - req = p9_client_rpc(clnt, P9_TREAD, "dqd", fid->fid, offset, 1584 - rsize); 1585 - } 1586 - if (IS_ERR(req)) { 1587 - *err = PTR_ERR(req); 1558 + count = p9_client_read_once(fid, offset, to, err); 1559 + if (!count || *err) 1588 1560 break; 1589 - } 1590 - 1591 - *err = p9pdu_readf(&req->rc, clnt->proto_version, 1592 - "D", &count, &dataptr); 1593 - if (*err) { 1594 - trace_9p_protocol_dump(clnt, &req->rc); 1595 - p9_tag_remove(clnt, req); 1596 - break; 1597 - } 1598 - if (rsize < count) { 1599 - pr_err("bogus RREAD count (%d > %d)\n", count, rsize); 1600 - count = rsize; 1601 - } 1602 - 1603 - p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count); 1604 - if (!count) { 1605 - p9_tag_remove(clnt, req); 1606 - break; 1607 - } 1608 - 1609 - if (non_zc) { 1610 - int n = copy_to_iter(dataptr, count, to); 1611 - total += n; 1612 - offset += n; 1613 - if (n != count) { 1614 - *err = -EFAULT; 1615 - p9_tag_remove(clnt, req); 1616 - break; 1617 - } 1618 - } else { 1619 - iov_iter_advance(to, count); 1620 - total += count; 1621 - offset += count; 1622 - } 1623 - p9_tag_remove(clnt, req); 1561 + offset += count; 1562 + total += count; 1624 1563 } 1625 1564 return total; 1626 1565 } 1627 1566 EXPORT_SYMBOL(p9_client_read); 1567 + 1568 + int 1569 + p9_client_read_once(struct p9_fid *fid, u64 offset, struct iov_iter *to, 1570 + int *err) 1571 + { 1572 + struct p9_client *clnt = fid->clnt; 1573 + struct p9_req_t *req; 1574 + int count = iov_iter_count(to); 1575 + int rsize, non_zc = 0; 1576 + char *dataptr; 1577 + 1578 + *err = 0; 1579 + p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n", 1580 + fid->fid, (unsigned long long) offset, (int)iov_iter_count(to)); 1581 + 1582 + rsize = fid->iounit; 1583 + if (!rsize || rsize > clnt->msize - P9_IOHDRSZ) 1584 + rsize = clnt->msize - P9_IOHDRSZ; 1585 + 1586 + if (count < rsize) 1587 + rsize = count; 1588 + 1589 + /* Don't bother zerocopy for small IO (< 1024) */ 1590 + if (clnt->trans_mod->zc_request && rsize > 1024) { 1591 + /* response header len is 11 1592 + * PDU Header(7) + IO Size (4) 1593 + */ 1594 + req = p9_client_zc_rpc(clnt, P9_TREAD, to, NULL, rsize, 1595 + 0, 11, "dqd", fid->fid, 1596 + offset, rsize); 1597 + } else { 1598 + non_zc = 1; 1599 + req = p9_client_rpc(clnt, P9_TREAD, "dqd", fid->fid, offset, 1600 + rsize); 1601 + } 1602 + if (IS_ERR(req)) { 1603 + *err = PTR_ERR(req); 1604 + return 0; 1605 + } 1606 + 1607 + *err = p9pdu_readf(&req->rc, clnt->proto_version, 1608 + "D", &count, &dataptr); 1609 + if (*err) { 1610 + trace_9p_protocol_dump(clnt, &req->rc); 1611 + p9_tag_remove(clnt, req); 1612 + return 0; 1613 + } 1614 + if (rsize < count) { 1615 + pr_err("bogus RREAD count (%d > %d)\n", count, rsize); 1616 + count = rsize; 1617 + } 1618 + 1619 + p9_debug(P9_DEBUG_9P, "<<< RREAD count %d\n", count); 1620 + if (!count) { 1621 + p9_tag_remove(clnt, req); 1622 + return 0; 1623 + } 1624 + 1625 + if (non_zc) { 1626 + int n = copy_to_iter(dataptr, count, to); 1627 + 1628 + if (n != count) { 1629 + *err = -EFAULT; 1630 + p9_tag_remove(clnt, req); 1631 + return n; 1632 + } 1633 + } else { 1634 + iov_iter_advance(to, count); 1635 + } 1636 + p9_tag_remove(clnt, req); 1637 + return count; 1638 + } 1639 + EXPORT_SYMBOL(p9_client_read_once); 1628 1640 1629 1641 int 1630 1642 p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err)