diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-24 18:17:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-09 16:29:10 -0500 |
commit | e5a4b0bb803b39a36478451eae53a880d2663d5b (patch) | |
tree | 2e7c71032ede136c8e8f975bf7a79a692df76535 /drivers/target | |
parent | 17836394e578b8d6475ecdb309ad1356bbcf37a2 (diff) |
switch memcpy_to_msg() and skb_copy{,_and_csum}_datagram_msg() to primitives
... making both non-draining. That means that tcp_recvmsg() becomes
non-draining. And _that_ would break iscsit_do_rx_data() unless we
a) make sure tcp_recvmsg() is uniformly non-draining (it is)
b) make sure it copes with arbitrary (including shifted)
iov_iter (it does, all it uses is iov_iter primitives)
c) make iscsit_do_rx_data() initialize ->msg_iter only once.
Fortunately, (c) is doable with minimal work and we are rid of one
the two places where kernel send/recvmsg users would be unhappy with
non-draining behaviour.
Actually, that makes all but one of ->recvmsg() instances iov_iter-clean.
The exception is skcipher_recvmsg() and it also isn't hard to convert
to primitives (iov_iter_get_pages() is needed there). That'll wait
a bit - there's some interplay with ->sendmsg() path for that one.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_util.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index ce87ce9bdb9c..7c6a95bcb35e 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -1326,21 +1326,19 @@ static int iscsit_do_rx_data( | |||
1326 | struct iscsi_conn *conn, | 1326 | struct iscsi_conn *conn, |
1327 | struct iscsi_data_count *count) | 1327 | struct iscsi_data_count *count) |
1328 | { | 1328 | { |
1329 | int data = count->data_length, rx_loop = 0, total_rx = 0, iov_len; | 1329 | int data = count->data_length, rx_loop = 0, total_rx = 0; |
1330 | struct kvec *iov_p; | ||
1331 | struct msghdr msg; | 1330 | struct msghdr msg; |
1332 | 1331 | ||
1333 | if (!conn || !conn->sock || !conn->conn_ops) | 1332 | if (!conn || !conn->sock || !conn->conn_ops) |
1334 | return -1; | 1333 | return -1; |
1335 | 1334 | ||
1336 | memset(&msg, 0, sizeof(struct msghdr)); | 1335 | memset(&msg, 0, sizeof(struct msghdr)); |
1337 | 1336 | iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, | |
1338 | iov_p = count->iov; | 1337 | count->iov, count->iov_count, data); |
1339 | iov_len = count->iov_count; | ||
1340 | 1338 | ||
1341 | while (total_rx < data) { | 1339 | while (total_rx < data) { |
1342 | rx_loop = kernel_recvmsg(conn->sock, &msg, iov_p, iov_len, | 1340 | rx_loop = sock_recvmsg(conn->sock, &msg, |
1343 | (data - total_rx), MSG_WAITALL); | 1341 | (data - total_rx), MSG_WAITALL); |
1344 | if (rx_loop <= 0) { | 1342 | if (rx_loop <= 0) { |
1345 | pr_debug("rx_loop: %d total_rx: %d\n", | 1343 | pr_debug("rx_loop: %d total_rx: %d\n", |
1346 | rx_loop, total_rx); | 1344 | rx_loop, total_rx); |