From b3ffcfe3ac81b96026e9af04fdbb64e1efa5fb2f Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 20 Dec 2006 17:48:08 +0000 Subject: Work around write performace issues due to missing TCP_NODELAY in sshd --- ChangeLog | 5 +++++ sshfs.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b933cc5..d500221 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-20 Miklos Szeredi + + * Work around write performace issues due to missing TCP_NODELAY + in sshd. Reported by Justin Searle + 2006-11-10 Miklos Szeredi * Fix bug which ommitted directory entries for symlinks with the diff --git a/sshfs.c b/sshfs.c index eb5dce4..499689d 100644 --- a/sshfs.c +++ b/sshfs.c @@ -158,6 +158,7 @@ struct sshfs { char *workarounds; int rename_workaround; int nodelay_workaround; + int nodelaysrv_workaround; int truncate_workaround; int transform_symlinks; int follow_symlinks; @@ -271,6 +272,7 @@ static struct fuse_opt sshfs_opts[] = { static struct fuse_opt workaround_opts[] = { SSHFS_OPT("none", rename_workaround, 0), SSHFS_OPT("none", nodelay_workaround, 0), + SSHFS_OPT("none", nodelaysrv_workaround, 0), SSHFS_OPT("none", truncate_workaround, 0), SSHFS_OPT("all", rename_workaround, 1), SSHFS_OPT("all", nodelay_workaround, 1), @@ -279,6 +281,8 @@ static struct fuse_opt workaround_opts[] = { SSHFS_OPT("norename", rename_workaround, 0), SSHFS_OPT("nodelay", nodelay_workaround, 1), SSHFS_OPT("nonodelay", nodelay_workaround, 0), + SSHFS_OPT("nodelaysrv", nodelaysrv_workaround, 1), + SSHFS_OPT("nonodelaysrv", nodelaysrv_workaround, 0), SSHFS_OPT("truncate", truncate_workaround, 1), SSHFS_OPT("notruncate", truncate_workaround, 0), FUSE_OPT_END @@ -691,6 +695,12 @@ static int start_ssh(void) if (sshfs.nodelay_workaround && do_ssh_nodelay_workaround() == -1) fprintf(stderr, "warning: ssh nodelay workaround disabled\n"); + if (sshfs.nodelaysrv_workaround) { + /* Hack to work around missing TCP_NODELAY setting in sshd */ + sshfs.ssh_args.argv[1] = "-X"; + setenv("DISPLAY", "", 1); + } + devnull = open("/dev/null", O_WRONLY); if (dup2(sockpair[1], 0) == -1 || dup2(sockpair[1], 1) == -1) { @@ -1047,7 +1057,7 @@ static int sftp_find_init_reply(uint32_t *version) static int sftp_init() { int res = -1; - uint32_t version; + uint32_t version = 0; struct buffer buf; buf_init(&buf, 0); if (sftp_send_iov(SSH_FXP_INIT, PROTO_VERSION, NULL, 0) == -1) @@ -2413,6 +2423,7 @@ static void usage(const char *progname) " all all workarounds enabled\n" " [no]rename fix renaming to existing file (default: off)\n" " [no]nodelay set nodelay tcp flag in ssh (default: on)\n" +" [no]nodelaysrv set nodelay tcp flag in sshd (default: on)\n" " [no]truncate fix truncate for old servers (default: off)\n" " -o idmap=TYPE user/group ID mapping, possible types are:\n" " none no translation of the ID space (default)\n" @@ -2570,6 +2581,7 @@ int main(int argc, char *argv[]) sshfs.blksize = 4096; sshfs.max_read = 65536; sshfs.nodelay_workaround = 1; + sshfs.nodelaysrv_workaround = 1; sshfs.rename_workaround = 0; sshfs.truncate_workaround = 0; sshfs.ssh_ver = 2; -- cgit v1.2.3