Hello community, here is the log from the commit of package sshfs checked in at Thu May 17 14:37:18 CEST 2007. -------- --- sshfs/sshfs.changes 2006-10-12 18:05:18.000000000 +0200 +++ /mounts/work_src_done/STABLE/sshfs/sshfs.changes 2007-05-17 12:04:18.725939000 +0200 @@ -1,0 +2,15 @@ +Thu May 17 11:54:49 CEST 2007 - mszeredi@suse.de + +- updated to version 1.8 + * Fix rare crashes due to uninitialized threading in glib + * Fix memory leak in open + * Fix crash when sem_wait() is interrupted (e.g. by gdb) + * Fix caching when renaming a directory + * Work around crash of sftp-server when its input buffer is full + * Add option to work around performance problem with old ssh + servers + * Fix bug in follow_symlinks option +- Don't build sshnodelay.so, which is not needed any more with + current ssh clients + +------------------------------------------------------------------- Old: ---- sshfs-fuse-1.6.diff sshfs-fuse-1.7.tar.bz2 New: ---- sshfs-fuse-1.8.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sshfs.spec ++++++ --- /var/tmp/diff_new_pack.g22203/_old 2007-05-17 14:36:36.000000000 +0200 +++ /var/tmp/diff_new_pack.g22203/_new 2007-05-17 14:36:36.000000000 +0200 @@ -1,7 +1,7 @@ # -# spec file for package sshfs (Version 1.7) +# spec file for package sshfs (Version 1.8) # -# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # @@ -13,13 +13,12 @@ Name: sshfs BuildRequires: fuse-devel glib2-devel Summary: Filesystem client based on SSH file transfer protocol -Version: 1.7 +Version: 1.8 Release: 1 -License: GPL +License: GNU General Public License (GPL) Group: System/Filesystems Source: %{name}-fuse-%{version}.tar.bz2 -Patch: %{name}-fuse-1.6.diff -URL: http://fuse.sf.net/ +URL: http://fuse.sourceforge.net/sshfs.html BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -37,12 +36,11 @@ %prep %setup -n %{name}-fuse-%{version} -%patch %build %{?suse_update_config:%{suse_update_config -f}} autoreconf -fi -%configure +%configure --disable-sshnodelay make %install @@ -55,9 +53,20 @@ %defattr(-,root,root) %doc AUTHORS COPYING* ChangeLog NEWS README* %{_bindir}/* -%{_libdir}/sshnodelay.so -%changelog -n sshfs +%changelog +* Thu May 17 2007 - mszeredi@suse.de +- updated to version 1.8 + * Fix rare crashes due to uninitialized threading in glib + * Fix memory leak in open + * Fix crash when sem_wait() is interrupted (e.g. by gdb) + * Fix caching when renaming a directory + * Work around crash of sftp-server when its input buffer is full + * Add option to work around performance problem with old ssh + servers + * Fix bug in follow_symlinks option +- Don't build sshnodelay.so, which is not needed any more with + current ssh clients * Thu Oct 12 2006 - tiwai@suse.de - update to version 1.7: * Add option 'follow_symlinks' to resolve symlinks on the server ++++++ sshfs-fuse-1.7.tar.bz2 -> sshfs-fuse-1.8.tar.bz2 ++++++ ++++ 6555 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/cache.c new/sshfs-fuse-1.8/cache.c --- old/sshfs-fuse-1.7/cache.c 2006-08-16 10:51:21.000000000 +0200 +++ new/sshfs-fuse-1.8/cache.c 2007-04-18 22:10:46.000000000 +0200 @@ -116,9 +116,20 @@ pthread_mutex_unlock(&cache.lock); } +static int cache_del_children(const char *key, void *val_, const char *path) +{ + (void) val_; + if (strncmp(key, path, strlen(path)) == 0) + return TRUE; + else + return FALSE; +} + static void cache_do_rename(const char *from, const char *to) { pthread_mutex_lock(&cache.lock); + g_hash_table_foreach_remove(cache.table, (GHRFunc) cache_del_children, + (char *) from); cache_purge(from); cache_purge(to); cache_purge_parent(from); @@ -250,12 +261,14 @@ const struct stat *stbuf) { int err = ch->filler(ch->h, name, 0, 0); - if (!err && (stbuf->st_mode & S_IFMT)) { - char *fullpath; + if (!err) { g_ptr_array_add(ch->dir, g_strdup(name)); - fullpath = g_strdup_printf("%s/%s", !ch->path[1] ? "" : ch->path, name); - cache_add_attr(fullpath, stbuf); - g_free(fullpath); + if (stbuf->st_mode & S_IFMT) { + char *fullpath = + g_strdup_printf("%s/%s", !ch->path[1] ? "" : ch->path, name); + cache_add_attr(fullpath, stbuf); + g_free(fullpath); + } } return err; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/ChangeLog new/sshfs-fuse-1.8/ChangeLog --- old/sshfs-fuse-1.7/ChangeLog 2006-08-18 12:38:12.000000000 +0200 +++ new/sshfs-fuse-1.8/ChangeLog 2007-05-16 13:20:48.000000000 +0200 @@ -1,3 +1,54 @@ +2007-05-16 Miklos Szeredi <miklos@szeredi.hu> + + * Released 1.8 + +2007-05-15 Miklos Szeredi <miklos@szeredi.hu> + + * Add needed g_thread_init() to fix rare crashes. Reported by + Dimitrios Apostolou + + * Fix memory leak in sshfs_open_common() + +2007-04-18 Miklos Szeredi <miklos@szeredi.hu> + + * Fix crash within gdb, caused by sem_wait() returning with an + error on interrupt. Reported by Dimitrios Apostolou + + * Fix spurious cache entries remaining after renaming a directory + +2007-02-28 Miklos Szeredi <miklos@szeredi.hu> + + * Don't set DISPLAY environment variable to "", because it breaks + ssh-askpass. Make nodelaysrv_workaround default to off, because + with this change it may have security implications. + +2007-02-19 Miklos Szeredi <miklos@szeredi.hu> + + * OpenSSH sftp-server can read requests faster, than it processes + them, when it's buffer is full it aborts. This can happen on a + large upload to a slow server. Work around this by limiting the + total size of outstanding reqests. Debian bug #365541. Tracked + down by Thue Janus Kristensen + + * Add --disable-sshnodelay configure option. The sshnodelay.so + hack shouldnt be needed with OpenSSH client versions >= 4.3 + +2006-12-20 Miklos Szeredi <miklos@szeredi.hu> + + * Work around write performace issues due to missing TCP_NODELAY + in sshd. Reported by Justin Searle + +2006-11-10 Miklos Szeredi <miklos@szeredi.hu> + + * Fix bug which ommitted directory entries for symlinks with the + -ofollow_symlinks option. Bug reported by Mikael Ståldal + +2006-09-29 Miklos Szeredi <miklos@szeredi.hu> + + * Fix segfault if there are outstanding writes to the server after + release on the file descriptor. This only happened on FreeBSD. + Reported by Andriy Gapon + 2006-08-18 Miklos Szeredi <miklos@szeredi.hu> * Released 1.7 diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/config.h.in new/sshfs-fuse-1.8/config.h.in --- old/sshfs-fuse-1.7/config.h.in 2006-08-17 12:02:42.000000000 +0200 +++ new/sshfs-fuse-1.8/config.h.in 2007-05-16 13:21:17.000000000 +0200 @@ -18,5 +18,8 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* Compile ssh NODELAY workaround */ +#undef SSH_NODELAY_WORKAROUND + /* Version number of package */ #undef VERSION diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/configure.ac new/sshfs-fuse-1.8/configure.ac --- old/sshfs-fuse-1.7/configure.ac 2006-08-17 11:58:48.000000000 +0200 +++ new/sshfs-fuse-1.8/configure.ac 2007-05-16 13:20:48.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT(sshfs-fuse, 1.7) +AC_INIT(sshfs-fuse, 1.8) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) @@ -10,8 +10,17 @@ AC_SUBST(sshnodelay_libs) LIBS= +AC_ARG_ENABLE(sshnodelay, + [ --disable-sshnodelay Don't compile NODELAY workaround for ssh]) + +if test "$enable_sshnodelay" != "no"; then + AC_DEFINE(SSH_NODELAY_WORKAROUND, 1, [Compile ssh NODELAY workaround]) +fi + +AM_CONDITIONAL(SSH_NODELAY_SO, test "$enable_sshnodelay" != "no") + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH -PKG_CHECK_MODULES(SSHFS, [fuse >= 2.2 glib-2.0]) +PKG_CHECK_MODULES(SSHFS, [fuse >= 2.2 glib-2.0 gthread-2.0]) have_fuse_opt_parse=no AC_CHECK_FUNC([fuse_opt_parse], [have_fuse_opt_parse=yes]) if test "$have_fuse_opt_parse" = no; then diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/Makefile.am new/sshfs-fuse-1.8/Makefile.am --- old/sshfs-fuse-1.7/Makefile.am 2006-08-17 12:06:24.000000000 +0200 +++ new/sshfs-fuse-1.8/Makefile.am 2007-04-18 11:41:46.000000000 +0200 @@ -14,6 +14,7 @@ EXTRA_DIST = sshnodelay.c FAQ.txt CLEANFILES = sshnodelay.so +if SSH_NODELAY_SO all-local: sshnodelay.so install-exec-local: sshnodelay.so @@ -25,3 +26,4 @@ sshnodelay.so: $(CC) -Wall -W -s --shared -fPIC $(sshnodelay_libs) sshnodelay.c -o sshnodelay.so +endif diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/NEWS new/sshfs-fuse-1.8/NEWS --- old/sshfs-fuse-1.7/NEWS 2006-08-17 12:10:50.000000000 +0200 +++ new/sshfs-fuse-1.8/NEWS 2007-05-16 13:20:48.000000000 +0200 @@ -1,3 +1,8 @@ +What is new in 1.8 +------------------ + +* Bug fixes + What is new in 1.7 ------------------ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/sshfs-fuse-1.7/sshfs.c new/sshfs-fuse-1.8/sshfs.c --- old/sshfs-fuse-1.7/sshfs.c 2006-08-18 12:34:08.000000000 +0200 +++ new/sshfs-fuse-1.8/sshfs.c 2007-05-16 13:20:48.000000000 +0200 @@ -124,6 +124,7 @@ struct timeval start; void *data; request_func end_func; + size_t len; struct list_head list; }; @@ -147,6 +148,7 @@ int is_seq; int connver; int modifver; + int refs; }; struct sshfs { @@ -157,7 +159,9 @@ char *workarounds; int rename_workaround; int nodelay_workaround; + int nodelaysrv_workaround; int truncate_workaround; + int buflimit_workaround; int transform_symlinks; int follow_symlinks; int no_check_root; @@ -184,6 +188,9 @@ unsigned blksize; char *progname; long modifver; + unsigned outstanding_len; + unsigned max_outstanding_len; + pthread_cond_t outstanding_cond; }; static struct sshfs sshfs; @@ -270,16 +277,24 @@ 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("none", buflimit_workaround, 0), SSHFS_OPT("all", rename_workaround, 1), SSHFS_OPT("all", nodelay_workaround, 1), + SSHFS_OPT("all", nodelaysrv_workaround, 1), SSHFS_OPT("all", truncate_workaround, 1), + SSHFS_OPT("all", buflimit_workaround, 1), SSHFS_OPT("rename", rename_workaround, 1), 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), + SSHFS_OPT("buflimit", buflimit_workaround, 1), + SSHFS_OPT("nobuflimit", buflimit_workaround, 0), FUSE_OPT_END }; @@ -627,6 +642,7 @@ _exit(1); } +#ifdef SSH_NODELAY_WORKAROUND static int do_ssh_nodelay_workaround(void) { char *oldpreload = getenv("LD_PRELOAD"); @@ -668,6 +684,7 @@ g_free(newpreload); return 0; } +#endif static int start_ssh(void) { @@ -687,8 +704,15 @@ } else if (pid == 0) { int devnull; +#ifdef SSH_NODELAY_WORKAROUND if (sshfs.nodelay_workaround && do_ssh_nodelay_workaround() == -1) fprintf(stderr, "warning: ssh nodelay workaround disabled\n"); +#endif + + if (sshfs.nodelaysrv_workaround) { + /* Hack to work around missing TCP_NODELAY setting in sshd */ + sshfs.ssh_args.argv[1] = "-X"; + } devnull = open("/dev/null", O_WRONLY); @@ -822,7 +846,7 @@ unsigned nout = 0; assert(count <= SFTP_MAX_IOV - 1); - buf_init(&buf, 5); + buf_init(&buf, 9); buf_add_uint32(&buf, iov_length(iov, count) + 5); buf_add_uint8(&buf, type); buf_add_uint32(&buf, id); @@ -947,8 +971,13 @@ GUINT_TO_POINTER(id)); if (req == NULL) fprintf(stderr, "request %i not found\n", id); - else + else { + int was_over = sshfs.outstanding_len > sshfs.max_outstanding_len; + sshfs.outstanding_len -= req->len; + if (was_over && sshfs.outstanding_len <= sshfs.max_outstanding_len) + pthread_cond_broadcast(&sshfs.outstanding_cond); g_hash_table_remove(sshfs.reqtab, GUINT_TO_POINTER(id)); + } pthread_mutex_unlock(&sshfs.lock); if (req != NULL) { struct timeval now; @@ -1046,7 +1075,7 @@ 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) @@ -1270,7 +1299,7 @@ err = req->error; goto out; } - sem_wait(&req->ready); + while (sem_wait(&req->ready)); if (req->error) { err = req->error; goto out; @@ -1342,6 +1371,11 @@ pthread_mutex_unlock(&sshfs.lock); goto out; } + req->len = iov_length(iov, count) + 9; + sshfs.outstanding_len += req->len; + while (sshfs.outstanding_len > sshfs.max_outstanding_len) + pthread_cond_wait(&sshfs.outstanding_cond, &sshfs.lock); + g_hash_table_insert(sshfs.reqtab, GUINT_TO_POINTER(id), req); gettimeofday(&req->start, NULL); DEBUG("[%05i] %s\n", id, type_name(type)); @@ -1768,6 +1802,7 @@ pthread_cond_init(&sf->write_finished, NULL); /* Assume random read after open */ sf->is_seq = 0; + sf->refs = 1; sf->next_pos = 0; sf->modifver= sshfs.modifver; sf->connver = sshfs.connver; @@ -1782,8 +1817,11 @@ buf_add_path(&buf, path); err2 = sftp_request(sshfs.follow_symlinks ? SSH_FXP_STAT : SSH_FXP_LSTAT, &buf, SSH_FXP_ATTRS, &outbuf); - if (!err2 && buf_get_attrs(&outbuf, &stbuf, NULL) == -1) - err2 = -EIO; + if (!err2) { + if (buf_get_attrs(&outbuf, &stbuf, NULL) == -1) + err2 = -EIO; + buf_free(&outbuf); + } err = sftp_request_wait(open_req, SSH_FXP_OPEN, SSH_FXP_HANDLE, &sf->handle); if (!err && err2) { @@ -1851,6 +1889,19 @@ return sshfs_flush(path, fi); } +static void sshfs_file_put(struct sshfs_file *sf) +{ + sf->refs--; + if (!sf->refs) + g_free(sf); +} + +static struct sshfs_file *sshfs_file_get(struct sshfs_file *sf) +{ + sf->refs++; + return sf; +} + static int sshfs_release(const char *path, struct fuse_file_info *fi) { struct sshfs_file *sf = get_sshfs_file(fi); @@ -1861,7 +1912,7 @@ } buf_free(handle); chunk_put_locked(sf->readahead); - g_free(sf); + sshfs_file_put(sf); return 0; } @@ -1973,7 +2024,7 @@ static int wait_chunk(struct read_chunk *chunk, char *buf, size_t size) { int res; - sem_wait(&chunk->ready); + while (sem_wait(&chunk->ready)); res = chunk->res; if (res > 0) { if ((size_t) res > size) @@ -2084,6 +2135,7 @@ } list_del(&req->list); pthread_cond_broadcast(&sf->write_finished); + sshfs_file_put(sf); } static int sshfs_write(const char *path, const char *wbuf, size_t size, @@ -2110,7 +2162,7 @@ iov[1].iov_len = size; if (!sshfs.sync_write && !sf->write_error) err = sftp_request_send(SSH_FXP_WRITE, iov, 2, sshfs_write_begin, - sshfs_write_end, 0, sf, NULL); + sshfs_write_end, 0, sshfs_file_get(sf), NULL); else err = sftp_request_iov(SSH_FXP_WRITE, iov, 2, SSH_FXP_STATUS, NULL); buf_free(&buf); @@ -2330,6 +2382,7 @@ { pthread_mutex_init(&sshfs.lock, NULL); pthread_mutex_init(&sshfs.lock_write, NULL); + pthread_cond_init(&sshfs.outstanding_cond, NULL); sshfs.reqtab = g_hash_table_new(NULL, NULL); if (!sshfs.reqtab) { fprintf(stderr, "failed to create hash table\n"); @@ -2396,8 +2449,12 @@ " none no workarounds enabled\n" " all all workarounds enabled\n" " [no]rename fix renaming to existing file (default: off)\n" +#ifdef SSH_NODELAY_WORKAROUND " [no]nodelay set nodelay tcp flag in ssh (default: on)\n" +#endif +" [no]nodelaysrv set nodelay tcp flag in sshd (default: on)\n" " [no]truncate fix truncate for old servers (default: off)\n" +" [no]buflimit fix buffer fillup bug in server (default: on)\n" " -o idmap=TYPE user/group ID mapping, possible types are:\n" " none no translation of the ID space (default)\n" " user only translate UID of connecting user\n" @@ -2551,11 +2608,15 @@ char *base_path; const char *sftp_server; + g_thread_init(NULL); + sshfs.blksize = 4096; sshfs.max_read = 65536; sshfs.nodelay_workaround = 1; + sshfs.nodelaysrv_workaround = 0; sshfs.rename_workaround = 0; sshfs.truncate_workaround = 0; + sshfs.buflimit_workaround = 1; sshfs.ssh_ver = 2; sshfs.progname = argv[0]; ssh_add_arg("ssh"); @@ -2567,6 +2628,14 @@ parse_workarounds() == -1) exit(1); + if (sshfs.buflimit_workaround) + /* Work around buggy sftp-server in OpenSSH. Without this on + a slow server a 10Mbyte buffer would fill up and the server + would abort */ + sshfs.max_outstanding_len = 8388608; + else + sshfs.max_outstanding_len = ~0; + if (!sshfs.host) { fprintf(stderr, "missing host\n"); fprintf(stderr, "see `%s -h' for usage\n", argv[0]); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de