Commit 1b4e992f authored by Al Viro's avatar Al Viro Committed by Greg Kroah-Hartman

staging: lustre: ksocknal_lib_send_kiov(): 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 805560e8
...@@ -106,10 +106,6 @@ ksocknal_lib_send_kiov(struct ksock_conn *conn, struct ksock_tx *tx) ...@@ -106,10 +106,6 @@ ksocknal_lib_send_kiov(struct ksock_conn *conn, struct ksock_tx *tx)
/* Not NOOP message */ /* Not NOOP message */
LASSERT(tx->tx_lnetmsg); LASSERT(tx->tx_lnetmsg);
/*
* NB we can't trust socket ops to either consume our iovs
* or leave them alone.
*/
if (tx->tx_msg.ksm_zc_cookies[0]) { if (tx->tx_msg.ksm_zc_cookies[0]) {
/* Zero copy is enabled */ /* Zero copy is enabled */
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -132,34 +128,19 @@ ksocknal_lib_send_kiov(struct ksock_conn *conn, struct ksock_tx *tx) ...@@ -132,34 +128,19 @@ ksocknal_lib_send_kiov(struct ksock_conn *conn, struct ksock_tx *tx)
rc = tcp_sendpage(sk, page, offset, fragsize, msgflg); rc = tcp_sendpage(sk, page, offset, fragsize, msgflg);
} }
} else { } else {
#if SOCKNAL_SINGLE_FRAG_TX || !SOCKNAL_RISK_KMAP_DEADLOCK
struct kvec scratch;
struct kvec *scratchiov = &scratch;
unsigned int niov = 1;
#else
#ifdef CONFIG_HIGHMEM
#warning "XXX risk of kmap deadlock on multiple frags..."
#endif
struct kvec *scratchiov = conn->ksnc_scheduler->kss_scratch_iov;
unsigned int niov = tx->tx_nkiov;
#endif
struct msghdr msg = {.msg_flags = MSG_DONTWAIT}; struct msghdr msg = {.msg_flags = MSG_DONTWAIT};
int i; int i;
for (nob = i = 0; i < niov; i++) { for (nob = i = 0; i < tx->tx_nkiov; i++)
scratchiov[i].iov_base = kmap(kiov[i].bv_page) + nob += kiov[i].bv_len;
kiov[i].bv_offset;
nob += scratchiov[i].iov_len = kiov[i].bv_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, (struct kvec *)scratchiov, niov, nob); iov_iter_bvec(&msg.msg_iter, WRITE | ITER_BVEC,
kiov, tx->tx_nkiov, nob);
for (i = 0; i < niov; i++) rc = sock_sendmsg(sock, &msg);
kunmap(kiov[i].bv_page);
} }
return rc; return rc;
} }
......
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