9p: patches for 4.1 merge window
Some accumulated cleanup patches for kerneldoc and unused variables as well as some lock bug fixes and adding privateport option for RDMA. A quick check shows some merge-conflicts versus current-tip on 9p: use unsigned integers for nwqid/count If you would prefer I can rebase, remerge and fix the patch but didn't want to do that and look the for-next references. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org iQIcBAABAgAGBQJVMqXZAAoJEDZk62b0Tg6xBD4P/03nCkTxE5qDN9TVUSNdwHQD Oyq3JvvmfOORDHy7pZMp7wTdU4OLz+78RHYprpgJCk4Vs8Gcnl3hloeZ3L9l/W7J tz2Ek1noEE9uZLmeH6WPzSaba0sFOlnjbWPsLE8O84/zHOI/qj75s0UDPdrFRt1x LvMNQlTZqgUx0hogq1yLFKjp49bUzph78gMaJkoKK+30q9B4skPRRV93HLLzlo9j 0dAGd0yhO8xUjtlm/ZkXIKiyeGeQ2XXj6UTnH6/4nwL29yVosWkGNjqIXkgz+ROu eyPvJqrjaBVtj8ZJkwfyZqM6xPrnsEbuSYUKLT2GcId87Ycebd7Wq1w+vhAO7l0H N1ZnzMGlQXHTszEhDGVCICCv1QU8b3ifvtA+nQYUly9JnDeIBcZGQ16g0oYQNoes 1L6XKsrX4wdxROHYLqRJoNQ120KcaXAnRE3AmT8emiU8gl0KWW0TJ7WpLs9ICKRg cwgz1UzeGb/GGRtCv0gTlAE07fe/OjQVrSM3Q+ivTA+juRE2MWvluYh/WAMQHdFV FnJ5/sPKbcGK+IrHNWktkTLm2ZbbdcDnWHLmtk3egT3IubY5iLVpa5ADV47WsLAa viDp7N3mK0kZL8BJHgPs+aspRwMAHavme/EWzkuRTL048ABo8uTrM/BXiYsAaBBI GGh4+vEwcFDQdg2gMbF9 =2sr2 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
dba94f2155
|
@ -78,7 +78,6 @@ enum p9_cache_modes {
|
||||||
* @cache: cache mode of type &p9_cache_modes
|
* @cache: cache mode of type &p9_cache_modes
|
||||||
* @cachetag: the tag of the cache associated with this session
|
* @cachetag: the tag of the cache associated with this session
|
||||||
* @fscache: session cookie associated with FS-Cache
|
* @fscache: session cookie associated with FS-Cache
|
||||||
* @options: copy of options string given by user
|
|
||||||
* @uname: string user name to mount hierarchy as
|
* @uname: string user name to mount hierarchy as
|
||||||
* @aname: mount specifier for remote hierarchy
|
* @aname: mount specifier for remote hierarchy
|
||||||
* @maxdata: maximum data to be sent/recvd per protocol message
|
* @maxdata: maximum data to be sent/recvd per protocol message
|
||||||
|
|
|
@ -231,9 +231,7 @@ static int v9fs_launder_page(struct page *page)
|
||||||
/**
|
/**
|
||||||
* v9fs_direct_IO - 9P address space operation for direct I/O
|
* v9fs_direct_IO - 9P address space operation for direct I/O
|
||||||
* @iocb: target I/O control block
|
* @iocb: target I/O control block
|
||||||
* @iov: array of vectors that define I/O buffer
|
|
||||||
* @pos: offset in file to begin the operation
|
* @pos: offset in file to begin the operation
|
||||||
* @nr_segs: size of iovec array
|
|
||||||
*
|
*
|
||||||
* The presence of v9fs_direct_IO() in the address space ops vector
|
* The presence of v9fs_direct_IO() in the address space ops vector
|
||||||
* allowes open() O_DIRECT flags which would have failed otherwise.
|
* allowes open() O_DIRECT flags which would have failed otherwise.
|
||||||
|
|
|
@ -151,7 +151,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
struct p9_flock flock;
|
struct p9_flock flock;
|
||||||
struct p9_fid *fid;
|
struct p9_fid *fid;
|
||||||
uint8_t status;
|
uint8_t status = P9_LOCK_ERROR;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
unsigned char fl_type;
|
unsigned char fl_type;
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
res = p9_client_lock_dotl(fid, &flock, &status);
|
res = p9_client_lock_dotl(fid, &flock, &status);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
break;
|
goto out_unlock;
|
||||||
|
|
||||||
if (status != P9_LOCK_BLOCKED)
|
if (status != P9_LOCK_BLOCKED)
|
||||||
break;
|
break;
|
||||||
|
@ -214,14 +214,16 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
|
||||||
case P9_LOCK_BLOCKED:
|
case P9_LOCK_BLOCKED:
|
||||||
res = -EAGAIN;
|
res = -EAGAIN;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
WARN_ONCE(1, "unknown lock status code: %d\n", status);
|
||||||
|
/* fallthough */
|
||||||
case P9_LOCK_ERROR:
|
case P9_LOCK_ERROR:
|
||||||
case P9_LOCK_GRACE:
|
case P9_LOCK_GRACE:
|
||||||
res = -ENOLCK;
|
res = -ENOLCK;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
/*
|
/*
|
||||||
* incase server returned error for lock request, revert
|
* incase server returned error for lock request, revert
|
||||||
* it locally
|
* it locally
|
||||||
|
|
|
@ -275,7 +275,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'R':{
|
case 'R':{
|
||||||
int16_t *nwqid = va_arg(ap, int16_t *);
|
uint16_t *nwqid = va_arg(ap, uint16_t *);
|
||||||
struct p9_qid **wqids =
|
struct p9_qid **wqids =
|
||||||
va_arg(ap, struct p9_qid **);
|
va_arg(ap, struct p9_qid **);
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
||||||
stbuf->n_gid, stbuf->n_muid);
|
stbuf->n_gid, stbuf->n_muid);
|
||||||
} break;
|
} break;
|
||||||
case 'V':{
|
case 'V':{
|
||||||
int32_t count = va_arg(ap, int32_t);
|
uint32_t count = va_arg(ap, uint32_t);
|
||||||
struct iov_iter *from =
|
struct iov_iter *from =
|
||||||
va_arg(ap, struct iov_iter *);
|
va_arg(ap, struct iov_iter *);
|
||||||
errcode = p9pdu_writef(pdu, proto_version, "d",
|
errcode = p9pdu_writef(pdu, proto_version, "d",
|
||||||
|
@ -471,7 +471,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'R':{
|
case 'R':{
|
||||||
int16_t nwqid = va_arg(ap, int);
|
uint16_t nwqid = va_arg(ap, int);
|
||||||
struct p9_qid *wqids =
|
struct p9_qid *wqids =
|
||||||
va_arg(ap, struct p9_qid *);
|
va_arg(ap, struct p9_qid *);
|
||||||
|
|
||||||
|
|
|
@ -734,6 +734,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
|
||||||
opts->port = P9_PORT;
|
opts->port = P9_PORT;
|
||||||
opts->rfd = ~0;
|
opts->rfd = ~0;
|
||||||
opts->wfd = ~0;
|
opts->wfd = ~0;
|
||||||
|
opts->privport = 0;
|
||||||
|
|
||||||
if (!params)
|
if (!params)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1013,7 +1014,6 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct p9_fd_opts opts;
|
struct p9_fd_opts opts;
|
||||||
struct p9_trans_fd *p;
|
|
||||||
|
|
||||||
parse_opts(args, &opts);
|
parse_opts(args, &opts);
|
||||||
|
|
||||||
|
@ -1026,7 +1026,6 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
p = (struct p9_trans_fd *) client->trans;
|
|
||||||
p9_conn_create(client);
|
p9_conn_create(client);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -139,6 +139,7 @@ struct p9_rdma_opts {
|
||||||
int sq_depth;
|
int sq_depth;
|
||||||
int rq_depth;
|
int rq_depth;
|
||||||
long timeout;
|
long timeout;
|
||||||
|
int privport;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -146,7 +147,10 @@ struct p9_rdma_opts {
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Options that take integer arguments */
|
/* Options that take integer arguments */
|
||||||
Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, Opt_err,
|
Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout,
|
||||||
|
/* Options that take no argument */
|
||||||
|
Opt_privport,
|
||||||
|
Opt_err,
|
||||||
};
|
};
|
||||||
|
|
||||||
static match_table_t tokens = {
|
static match_table_t tokens = {
|
||||||
|
@ -154,6 +158,7 @@ static match_table_t tokens = {
|
||||||
{Opt_sq_depth, "sq=%u"},
|
{Opt_sq_depth, "sq=%u"},
|
||||||
{Opt_rq_depth, "rq=%u"},
|
{Opt_rq_depth, "rq=%u"},
|
||||||
{Opt_timeout, "timeout=%u"},
|
{Opt_timeout, "timeout=%u"},
|
||||||
|
{Opt_privport, "privport"},
|
||||||
{Opt_err, NULL},
|
{Opt_err, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -175,6 +180,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
|
||||||
opts->sq_depth = P9_RDMA_SQ_DEPTH;
|
opts->sq_depth = P9_RDMA_SQ_DEPTH;
|
||||||
opts->rq_depth = P9_RDMA_RQ_DEPTH;
|
opts->rq_depth = P9_RDMA_RQ_DEPTH;
|
||||||
opts->timeout = P9_RDMA_TIMEOUT;
|
opts->timeout = P9_RDMA_TIMEOUT;
|
||||||
|
opts->privport = 0;
|
||||||
|
|
||||||
if (!params)
|
if (!params)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -193,13 +199,13 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
|
||||||
if (!*p)
|
if (!*p)
|
||||||
continue;
|
continue;
|
||||||
token = match_token(p, tokens, args);
|
token = match_token(p, tokens, args);
|
||||||
if (token == Opt_err)
|
if ((token != Opt_err) && (token != Opt_privport)) {
|
||||||
continue;
|
r = match_int(&args[0], &option);
|
||||||
r = match_int(&args[0], &option);
|
if (r < 0) {
|
||||||
if (r < 0) {
|
p9_debug(P9_DEBUG_ERROR,
|
||||||
p9_debug(P9_DEBUG_ERROR,
|
"integer field, but no integer?\n");
|
||||||
"integer field, but no integer?\n");
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
}
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case Opt_port:
|
case Opt_port:
|
||||||
|
@ -214,6 +220,9 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
|
||||||
case Opt_timeout:
|
case Opt_timeout:
|
||||||
opts->timeout = option;
|
opts->timeout = option;
|
||||||
break;
|
break;
|
||||||
|
case Opt_privport:
|
||||||
|
opts->privport = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -607,6 +616,23 @@ static int rdma_cancelled(struct p9_client *client, struct p9_req_t *req)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma)
|
||||||
|
{
|
||||||
|
struct sockaddr_in cl = {
|
||||||
|
.sin_family = AF_INET,
|
||||||
|
.sin_addr.s_addr = htonl(INADDR_ANY),
|
||||||
|
};
|
||||||
|
int port, err = -EINVAL;
|
||||||
|
|
||||||
|
for (port = P9_DEF_MAX_RESVPORT; port >= P9_DEF_MIN_RESVPORT; port--) {
|
||||||
|
cl.sin_port = htons((ushort)port);
|
||||||
|
err = rdma_bind_addr(rdma->cm_id, (struct sockaddr *)&cl);
|
||||||
|
if (err != -EADDRINUSE)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trans_create_rdma - Transport method for creating atransport instance
|
* trans_create_rdma - Transport method for creating atransport instance
|
||||||
* @client: client instance
|
* @client: client instance
|
||||||
|
@ -642,6 +668,16 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args)
|
||||||
/* Associate the client with the transport */
|
/* Associate the client with the transport */
|
||||||
client->trans = rdma;
|
client->trans = rdma;
|
||||||
|
|
||||||
|
/* Bind to a privileged port if we need to */
|
||||||
|
if (opts.privport) {
|
||||||
|
err = p9_rdma_bind_privport(rdma);
|
||||||
|
if (err < 0) {
|
||||||
|
pr_err("%s (%d): problem binding to privport: %d\n",
|
||||||
|
__func__, task_pid_nr(current), -err);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Resolve the server's address */
|
/* Resolve the server's address */
|
||||||
rdma->addr.sin_family = AF_INET;
|
rdma->addr.sin_family = AF_INET;
|
||||||
rdma->addr.sin_addr.s_addr = in_aton(addr);
|
rdma->addr.sin_addr.s_addr = in_aton(addr);
|
||||||
|
|
|
@ -525,7 +525,10 @@ static ssize_t p9_mount_tag_show(struct device *dev,
|
||||||
vdev = dev_to_virtio(dev);
|
vdev = dev_to_virtio(dev);
|
||||||
chan = vdev->priv;
|
chan = vdev->priv;
|
||||||
|
|
||||||
return snprintf(buf, chan->tag_len + 1, "%s", chan->tag);
|
memcpy(buf, chan->tag, chan->tag_len);
|
||||||
|
buf[chan->tag_len] = 0;
|
||||||
|
|
||||||
|
return chan->tag_len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DEVICE_ATTR(mount_tag, 0444, p9_mount_tag_show, NULL);
|
static DEVICE_ATTR(mount_tag, 0444, p9_mount_tag_show, NULL);
|
||||||
|
|
Loading…
Reference in New Issue