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

Merge tag 'for-linus-4.1-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

Pull 9pfs updates from Eric Van Hensbergen:
"Some accumulated cleanup patches for kerneldoc and unused variables as
well as some lock bug fixes and adding privateport option for RDMA"

* tag 'for-linus-4.1-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
net/9p: add a privport option for RDMA transport.
fs/9p: Initialize status in v9fs_file_do_lock.
net/9p: Initialize opts->privport as it should be.
net/9p: use memcpy() instead of snprintf() in p9_mount_tag_show()
9p: use unsigned integers for nwqid/count
9p: do not crash on unknown lock status code
9p: fix error handling in v9fs_file_do_lock
9p: remove unused variable in p9_fd_create()
9p: kerneldoc warning fixes

+58 -21
-1
fs/9p/v9fs.h
··· 78 78 * @cache: cache mode of type &p9_cache_modes 79 79 * @cachetag: the tag of the cache associated with this session 80 80 * @fscache: session cookie associated with FS-Cache 81 - * @options: copy of options string given by user 82 81 * @uname: string user name to mount hierarchy as 83 82 * @aname: mount specifier for remote hierarchy 84 83 * @maxdata: maximum data to be sent/recvd per protocol message
-2
fs/9p/vfs_addr.c
··· 231 231 /** 232 232 * v9fs_direct_IO - 9P address space operation for direct I/O 233 233 * @iocb: target I/O control block 234 - * @iov: array of vectors that define I/O buffer 235 234 * @pos: offset in file to begin the operation 236 - * @nr_segs: size of iovec array 237 235 * 238 236 * The presence of v9fs_direct_IO() in the address space ops vector 239 237 * allowes open() O_DIRECT flags which would have failed otherwise.
+6 -4
fs/9p/vfs_file.c
··· 151 151 { 152 152 struct p9_flock flock; 153 153 struct p9_fid *fid; 154 - uint8_t status; 154 + uint8_t status = P9_LOCK_ERROR; 155 155 int res = 0; 156 156 unsigned char fl_type; 157 157 ··· 196 196 for (;;) { 197 197 res = p9_client_lock_dotl(fid, &flock, &status); 198 198 if (res < 0) 199 - break; 199 + goto out_unlock; 200 200 201 201 if (status != P9_LOCK_BLOCKED) 202 202 break; ··· 214 214 case P9_LOCK_BLOCKED: 215 215 res = -EAGAIN; 216 216 break; 217 + default: 218 + WARN_ONCE(1, "unknown lock status code: %d\n", status); 219 + /* fallthough */ 217 220 case P9_LOCK_ERROR: 218 221 case P9_LOCK_GRACE: 219 222 res = -ENOLCK; 220 223 break; 221 - default: 222 - BUG(); 223 224 } 224 225 226 + out_unlock: 225 227 /* 226 228 * incase server returned error for lock request, revert 227 229 * it locally
+3 -3
net/9p/protocol.c
··· 275 275 } 276 276 break; 277 277 case 'R':{ 278 - int16_t *nwqid = va_arg(ap, int16_t *); 278 + uint16_t *nwqid = va_arg(ap, uint16_t *); 279 279 struct p9_qid **wqids = 280 280 va_arg(ap, struct p9_qid **); 281 281 ··· 440 440 stbuf->n_gid, stbuf->n_muid); 441 441 } break; 442 442 case 'V':{ 443 - int32_t count = va_arg(ap, int32_t); 443 + uint32_t count = va_arg(ap, uint32_t); 444 444 struct iov_iter *from = 445 445 va_arg(ap, struct iov_iter *); 446 446 errcode = p9pdu_writef(pdu, proto_version, "d", ··· 471 471 } 472 472 break; 473 473 case 'R':{ 474 - int16_t nwqid = va_arg(ap, int); 474 + uint16_t nwqid = va_arg(ap, int); 475 475 struct p9_qid *wqids = 476 476 va_arg(ap, struct p9_qid *); 477 477
+1 -2
net/9p/trans_fd.c
··· 734 734 opts->port = P9_PORT; 735 735 opts->rfd = ~0; 736 736 opts->wfd = ~0; 737 + opts->privport = 0; 737 738 738 739 if (!params) 739 740 return 0; ··· 1014 1013 { 1015 1014 int err; 1016 1015 struct p9_fd_opts opts; 1017 - struct p9_trans_fd *p; 1018 1016 1019 1017 parse_opts(args, &opts); 1020 1018 ··· 1026 1026 if (err < 0) 1027 1027 return err; 1028 1028 1029 - p = (struct p9_trans_fd *) client->trans; 1030 1029 p9_conn_create(client); 1031 1030 1032 1031 return 0;
+44 -8
net/9p/trans_rdma.c
··· 139 139 int sq_depth; 140 140 int rq_depth; 141 141 long timeout; 142 + int privport; 142 143 }; 143 144 144 145 /* ··· 147 146 */ 148 147 enum { 149 148 /* Options that take integer arguments */ 150 - Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, Opt_err, 149 + Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, 150 + /* Options that take no argument */ 151 + Opt_privport, 152 + Opt_err, 151 153 }; 152 154 153 155 static match_table_t tokens = { ··· 158 154 {Opt_sq_depth, "sq=%u"}, 159 155 {Opt_rq_depth, "rq=%u"}, 160 156 {Opt_timeout, "timeout=%u"}, 157 + {Opt_privport, "privport"}, 161 158 {Opt_err, NULL}, 162 159 }; 163 160 ··· 180 175 opts->sq_depth = P9_RDMA_SQ_DEPTH; 181 176 opts->rq_depth = P9_RDMA_RQ_DEPTH; 182 177 opts->timeout = P9_RDMA_TIMEOUT; 178 + opts->privport = 0; 183 179 184 180 if (!params) 185 181 return 0; ··· 199 193 if (!*p) 200 194 continue; 201 195 token = match_token(p, tokens, args); 202 - if (token == Opt_err) 203 - continue; 204 - r = match_int(&args[0], &option); 205 - if (r < 0) { 206 - p9_debug(P9_DEBUG_ERROR, 207 - "integer field, but no integer?\n"); 208 - continue; 196 + if ((token != Opt_err) && (token != Opt_privport)) { 197 + r = match_int(&args[0], &option); 198 + if (r < 0) { 199 + p9_debug(P9_DEBUG_ERROR, 200 + "integer field, but no integer?\n"); 201 + continue; 202 + } 209 203 } 210 204 switch (token) { 211 205 case Opt_port: ··· 219 213 break; 220 214 case Opt_timeout: 221 215 opts->timeout = option; 216 + break; 217 + case Opt_privport: 218 + opts->privport = 1; 222 219 break; 223 220 default: 224 221 continue; ··· 616 607 return 0; 617 608 } 618 609 610 + static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma) 611 + { 612 + struct sockaddr_in cl = { 613 + .sin_family = AF_INET, 614 + .sin_addr.s_addr = htonl(INADDR_ANY), 615 + }; 616 + int port, err = -EINVAL; 617 + 618 + for (port = P9_DEF_MAX_RESVPORT; port >= P9_DEF_MIN_RESVPORT; port--) { 619 + cl.sin_port = htons((ushort)port); 620 + err = rdma_bind_addr(rdma->cm_id, (struct sockaddr *)&cl); 621 + if (err != -EADDRINUSE) 622 + break; 623 + } 624 + return err; 625 + } 626 + 619 627 /** 620 628 * trans_create_rdma - Transport method for creating atransport instance 621 629 * @client: client instance ··· 667 641 668 642 /* Associate the client with the transport */ 669 643 client->trans = rdma; 644 + 645 + /* Bind to a privileged port if we need to */ 646 + if (opts.privport) { 647 + err = p9_rdma_bind_privport(rdma); 648 + if (err < 0) { 649 + pr_err("%s (%d): problem binding to privport: %d\n", 650 + __func__, task_pid_nr(current), -err); 651 + goto error; 652 + } 653 + } 670 654 671 655 /* Resolve the server's address */ 672 656 rdma->addr.sin_family = AF_INET;
+4 -1
net/9p/trans_virtio.c
··· 525 525 vdev = dev_to_virtio(dev); 526 526 chan = vdev->priv; 527 527 528 - return snprintf(buf, chan->tag_len + 1, "%s", chan->tag); 528 + memcpy(buf, chan->tag, chan->tag_len); 529 + buf[chan->tag_len] = 0; 530 + 531 + return chan->tag_len + 1; 529 532 } 530 533 531 534 static DEVICE_ATTR(mount_tag, 0444, p9_mount_tag_show, NULL);