From: Miklos S. <mi...@sz...> - 2006-02-08 10:20:12
|
> Attached is the info from debug, however, I don't think it will help > much. The situation is this: When running either for a long period of > time with a few CPUs or shorter periods of time with more CPUs, sshfs > handles the load pretty well. But, after the run is stopped (for the > script I used it was CTRL+C, I could not LS the directory where the > mountpoint was NOR the mountpoint itself. It was only after I killed > the sshfs process that I could ls the directory again. There's no error > in the debug stuff that I saw, and when I tried to ls the directory it > just hung up. This is the key point. I think I know about this deadlock, it should already be fixed in CVS, but here's a patch against 1.4. Can you try it please? Thanks, Miklos Index: sshfs.c =================================================================== RCS file: /cvsroot/fuse/sshfs/sshfs.c,v retrieving revision 1.55 diff -u -r1.55 sshfs.c --- sshfs.c 10 Jan 2006 10:54:38 -0000 1.55 +++ sshfs.c 8 Feb 2006 10:14:46 -0000 @@ -161,6 +161,7 @@ char *base_path; GHashTable *reqtab; pthread_mutex_t lock; + pthread_mutex_t lock_write; int processing_thread_started; unsigned int randseed; int infd; @@ -721,9 +722,11 @@ buf_init(&buf2, 5); buf_add_uint32(&buf2, buf->len + 1); buf_add_uint8(&buf2, type); + pthread_mutex_lock(&sshfs.lock_write); res = do_write(&buf2); if (res != -1) res = do_write(buf); + pthread_mutex_unlock(&sshfs.lock_write); buf_free(&buf2); return res; } @@ -1046,14 +1049,15 @@ g_hash_table_insert(sshfs.reqtab, GUINT_TO_POINTER(id), req); gettimeofday(&req->start, NULL); DEBUG("[%05i] %s\n", id, type_name(type)); + pthread_mutex_unlock(&sshfs.lock); err = -EIO; if (sftp_send(type, &buf2) == -1) { + pthread_mutex_lock(&sshfs.lock); g_hash_table_remove(sshfs.reqtab, GUINT_TO_POINTER(id)); pthread_mutex_unlock(&sshfs.lock); goto out; } - pthread_mutex_unlock(&sshfs.lock); if (expect_type == 0) { buf_free(&buf2); @@ -1866,6 +1870,7 @@ static int processing_init(void) { pthread_mutex_init(&sshfs.lock, NULL); + pthread_mutex_init(&sshfs.lock_write, NULL); sshfs.reqtab = g_hash_table_new(NULL, NULL); if (!sshfs.reqtab) { fprintf(stderr, "failed to create hash table\n"); @@ -2069,6 +2074,10 @@ ssh_add_arg(sftp_server); free(sshfs.sftp_server); + res = processing_init(); + if (res == -1) + exit(1); + if (connect_remote() == -1) exit(1); @@ -2077,10 +2086,6 @@ sftp_detect_uid(); #endif - res = processing_init(); - if (res == -1) - exit(1); - res = cache_parse_options(&args); if (res == -1) exit(1); |