Commit 805560e8 authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

staging: lustre: ksocknal_lib_send_iov(): sendmsg doesn't bugger iovec...

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8040ddfb
...@@ -73,9 +73,9 @@ ksocknal_lib_zc_capable(struct ksock_conn *conn) ...@@ -73,9 +73,9 @@ ksocknal_lib_zc_capable(struct ksock_conn *conn)
int int
ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx) ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx)
{ {
struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
struct socket *sock = conn->ksnc_sock; struct socket *sock = conn->ksnc_sock;
int nob; int nob, i;
int rc;
if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */ if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */
conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */ conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */
...@@ -83,34 +83,16 @@ ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx) ...@@ -83,34 +83,16 @@ ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx)
!tx->tx_msg.ksm_csum) /* not checksummed */ !tx->tx_msg.ksm_csum) /* not checksummed */
ksocknal_lib_csum_tx(tx); ksocknal_lib_csum_tx(tx);
/* for (nob = i = 0; i < tx->tx_niov; i++)
* NB we can't trust socket ops to either consume our iovs nob += tx->tx_iov[i].iov_len;
* or leave them alone.
*/
{
#if SOCKNAL_SINGLE_FRAG_TX
struct kvec scratch;
struct kvec *scratchiov = &scratch;
unsigned int niov = 1;
#else
struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = tx->tx_niov;
#endif
struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i;
for (nob = i = 0; i < niov; i++) {
scratchiov[i] = tx->tx_iov[i];
nob += scratchiov[i].iov_len;
}
if (!list_empty(&conn->ksnc_tx_queue) || if (!list_empty(&conn->ksnc_tx_queue) ||
nob < tx->tx_resid) nob < tx->tx_resid)
msg.msg_flags |= MSG_MORE; msg.msg_flags |= MSG_MORE;
rc = kernel_sendmsg(sock, &msg, scratchiov, niov, nob); iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC,
} tx->tx_iov, tx->tx_niov, nob);
return rc; return sock_sendmsg(sock, &msg);
} }
int int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment