Skip to content

Commit 30d73a7

Browse files
bors[bot]Chris Townsend
authored andcommitted
Merge #1654
1654: [sshfs_mount] Add no compression and cache_timeout options r=Saviq a=townsend2010 Fixes #1502 Co-authored-by: Chris Townsend <[email protected]>
1 parent 0065e98 commit 30d73a7

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/sshfs_mount/sshfs_mount.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ auto get_sshfs_exec_and_options(mp::SSHSession& session)
8787

8888
auto version_info{run_cmd(session, fmt::format("sudo {} -V", sshfs_exec))};
8989

90-
sshfs_exec += " -o slave -o transform_symlinks -o allow_other";
90+
sshfs_exec += " -o slave -o transform_symlinks -o allow_other -o Compression=no";
9191

9292
auto fuse_version_line = mp::utils::match_line_for(version_info, fuse_version_string);
9393
if (!fuse_version_line.empty())
@@ -107,7 +107,11 @@ auto get_sshfs_exec_and_options(mp::SSHSession& session)
107107
// The option was made the default in libfuse 3.0
108108
else if (version::Semver200_version(fuse_version) < version::Semver200_version("3.0.0"))
109109
{
110-
sshfs_exec += " -o nonempty";
110+
sshfs_exec += " -o nonempty -o cache_timeout=3";
111+
}
112+
else
113+
{
114+
sshfs_exec += " -o dcache_timeout=3";
111115
}
112116
}
113117
else

tests/test_sshfsmount.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ struct SshfsMount : public mp::test::SftpServerTest
203203
"/home/ubuntu/\n"},
204204
{"id -u", "1000\n"},
205205
{"id -g", "1000\n"},
206-
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -o slave -o transform_symlinks -o allow_other :\"source\" "
206+
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -o slave -o transform_symlinks -o allow_other -o "
207+
"Compression=no -o dcache_timeout=3 :\"source\" "
207208
"\"target\"",
208209
"don't care\n"}};
209210
};
@@ -296,21 +297,22 @@ INSTANTIATE_TEST_SUITE_P(SshfsMountThrowWhenError, SshfsMountFail,
296297
testing::Values("mkdir", "chown", "id -u", "id -g", "cd", "echo $PWD"));
297298

298299
// Commands to check that a version of FUSE smaller that 3 gives a correct answer.
299-
CommandVector old_fuse_cmds = {{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -V", "FUSE library version: 2.9.0\n"},
300-
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -o slave -o transform_symlinks -o "
301-
"allow_other -o nonempty :\"source\" \"/home/ubuntu/target\"",
302-
"don't care\n"}};
300+
CommandVector old_fuse_cmds = {
301+
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -V", "FUSE library version: 2.9.0\n"},
302+
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -o slave -o transform_symlinks -o "
303+
"allow_other -o Compression=no -o nonempty -o cache_timeout=3 :\"source\" \"/home/ubuntu/target\"",
304+
"don't care\n"}};
303305

304306
// Commands to check that a version of FUSE at least 3.0.0 gives a correct answer.
305307
CommandVector new_fuse_cmds = {{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -V", "FUSE library version: 3.0.0\n"},
306308
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -o slave -o transform_symlinks -o "
307-
"allow_other :\"source\" \"/home/ubuntu/target\"",
309+
"allow_other -o Compression=no -o dcache_timeout=3 :\"source\" \"/home/ubuntu/target\"",
308310
"don't care\n"}};
309311

310312
// Commands to check that an unknown version of FUSE gives a correct answer.
311313
CommandVector unk_fuse_cmds = {{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -V", "weird fuse version\n"},
312314
{"sudo env LD_LIBRARY_PATH=/foo/bar /baz/bin/sshfs -o slave -o transform_symlinks -o "
313-
"allow_other :\"source\" \"/home/ubuntu/target\"",
315+
"allow_other -o Compression=no :\"source\" \"/home/ubuntu/target\"",
314316
"don't care\n"}};
315317

316318
// Commands to check that the server correctly creates the mount target.

0 commit comments

Comments
 (0)