Commit d4aecd1a authored by Petr Vandrovec's avatar Petr Vandrovec Committed by Linus Torvalds

[PATCH] ncpfs fails to correctly retry requests on timeout

sock_sendmsg() modifies iovec passed to it - it sets all length members of
iovec array to zero on success transmission (and even on failed if it
fails after iovec copy, but...) and advances pointers to point at the end
of buffers used. This has an unfortunate effect that ncpfs's retry on
failure does not work for IPX/UDP connections - kernel refused to do anything
because length from iovec was 0 while length passed to sock_sendmsg() was
correct.

This simple fix gets rid of a problem by creating temporary iovec copy, which can
sock_sendmsg destroy if it has such wish.
parent 88593e9d
...@@ -188,11 +188,14 @@ static inline void __ncptcp_abort(struct ncp_server *server) { ...@@ -188,11 +188,14 @@ static inline void __ncptcp_abort(struct ncp_server *server) {
static int ncpdgram_send(struct socket *sock, struct ncp_request_reply *req) { static int ncpdgram_send(struct socket *sock, struct ncp_request_reply *req) {
struct msghdr msg; struct msghdr msg;
struct iovec iov[3];
/* sock_sendmsg updates iov pointers for us :-( */
memcpy(iov, req->tx_ciov, req->tx_iovlen * sizeof(iov[0]));
msg.msg_name = NULL; msg.msg_name = NULL;
msg.msg_namelen = 0; msg.msg_namelen = 0;
msg.msg_control = NULL; msg.msg_control = NULL;
msg.msg_iov = req->tx_ciov; msg.msg_iov = iov;
msg.msg_iovlen = req->tx_iovlen; msg.msg_iovlen = req->tx_iovlen;
msg.msg_flags = MSG_DONTWAIT; msg.msg_flags = MSG_DONTWAIT;
return sock_sendmsg(sock, &msg, req->tx_totallen); return sock_sendmsg(sock, &msg, req->tx_totallen);
......
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