Louis-David Mitterrand <l...@apartia.fr> writes:

> On Wed, May 16, 2012 at 10:36:43PM +0200, Miklos Szeredi wrote:
>> >
>> > Hi,
>> >
>> > Please find the strace attached.
>> 
>> Thanks.
>> 
>> Still I have no clues, the EEXIST error is not seen in any of the system
>> calls and I can't see fopen returning EEXIST for any reason.
>> 
>> Can you try ltrace as well?   Though I don't have high hopes of that
>> revealing anything...
>
> Hi,
>
> Please find the ltrace outuput attached.

Can you please try the "disable_hardlink" option added by the attached
patch?

Thanks,
Miklos

diff --git a/sshfs.1 b/sshfs.1
index d316930..c045b3c 100644
--- a/sshfs.1
+++ b/sshfs.1
@@ -141,6 +141,11 @@ directly connect to PORT bypassing ssh
 \fB\-o\fR slave
 communicate over stdin and stdout bypassing network
 .TP
+\fB\-o\fR disable_hardlink
+link(2) will return with errno set to ENOSYS.  Hard links don't currently work
+perfectly on sshfs, and this confuses some programs.  If that happens try
+disabling hard links with this option.
+.TP
 \fB\-o\fR transform_symlinks
 transform absolute symlinks to relative
 .TP
diff --git a/sshfs.c b/sshfs.c
index 4945302..2e3d84a 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -203,6 +203,7 @@ struct sshfs {
 	int detect_uid;
 	int idmap;
 	int nomap;
+	int disable_hardlink;
 	char *uid_file;
 	char *gid_file;
 	GHashTable *uid_map;
@@ -358,6 +359,7 @@ static struct fuse_opt sshfs_opts[] = {
 	SSHFS_OPT("password_stdin",    password_stdin, 1),
 	SSHFS_OPT("delay_connect",     delay_connect, 1),
 	SSHFS_OPT("slave",             slave, 1),
+	SSHFS_OPT("disable_hardlink",  disable_hardlink, 1),
 
 	FUSE_OPT_KEY("-p ",            KEY_PORT),
 	FUSE_OPT_KEY("-C",             KEY_COMPRESS),
@@ -2192,7 +2194,7 @@ static int sshfs_link(const char *from, const char *to)
 {
 	int err = -ENOSYS;
 
-	if (sshfs.ext_hardlink) {
+	if (sshfs.ext_hardlink && !sshfs.disable_hardlink) {
 		struct buffer buf;
 
 		buf_init(&buf, 0);
@@ -3190,6 +3192,7 @@ static void usage(const char *progname)
 "    -o sftp_server=SERV    path to sftp server or subsystem (default: sftp)\n"
 "    -o directport=PORT     directly connect to PORT bypassing ssh\n"
 "    -o slave               communicate over stdin and stdout bypassing network\n"
+"    -o disable_hardlink    link(2) will return with errno set to ENOSYS\n"
 "    -o transform_symlinks  transform absolute symlinks to relative\n"
 "    -o follow_symlinks     follow symlinks on the server\n"
 "    -o no_check_root       don't check for existence of 'dir' on server\n"

Reply via email to