From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: torvalds@osdl.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] ncpfs data corruption when using large TCP transfers
Date: Thu, 6 May 2004 19:19:51 +0200 [thread overview]
Message-ID: <20040506171951.GA27715@vana.vc.cvut.cz> (raw)
Hi,
ncpfs was forgetting to update iovec's iov_base field whenever partial
transmission occured. This was causing data corruption during large
(60kB) writes.
Code now also passes copy of iovec to the sock_sendmsg, so it does not
rely on network stack updating (or not updating) passed iovec in case of
success (or failure).
Thanks,
Petr Vandrovec
diff -urdN linux/fs/ncpfs/sock.c linux/fs/ncpfs/sock.c
--- linux/fs/ncpfs/sock.c 2004-04-30 23:23:04.000000000 +0000
+++ linux/fs/ncpfs/sock.c 2004-05-05 19:51:07.000000000 +0000
@@ -205,17 +205,20 @@
struct ncp_request_reply *rq;
struct msghdr msg;
struct iovec* iov;
+ struct iovec iovc[3];
int result;
rq = server->tx.creq;
if (!rq) {
return;
}
-
+
+ /* sock_sendmsg updates iov pointers for us :-( */
+ memcpy(iovc, rq->tx_ciov, rq->tx_iovlen * sizeof(iov[0]));
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = NULL;
- msg.msg_iov = rq->tx_ciov;
+ msg.msg_iov = iovc;
msg.msg_iovlen = rq->tx_iovlen;
msg.msg_flags = MSG_NOSIGNAL | MSG_DONTWAIT;
result = sock_sendmsg(server->ncp_sock, &msg, rq->tx_totallen);
@@ -239,6 +242,7 @@
iov++;
rq->tx_iovlen--;
}
+ iov->iov_base += result;
iov->iov_len -= result;
rq->tx_ciov = iov;
}
reply other threads:[~2004-05-06 17:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040506171951.GA27715@vana.vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).