diff --git a/sesman/chansrv/chansrv_config.c b/sesman/chansrv/chansrv_config.c index 57a106728..000c8a4c8 100644 --- a/sesman/chansrv/chansrv_config.c +++ b/sesman/chansrv/chansrv_config.c @@ -40,6 +40,7 @@ #define DEFAULT_RESTRICT_INBOUND_CLIPBOARD 0 #define DEFAULT_ENABLE_FUSE_MOUNT 1 #define DEFAULT_FUSE_MOUNT_NAME "xrdp-client" +#define DEFAULT_FUSE_DIRECT_IO 0 #define DEFAULT_FILE_UMASK 077 #define DEFAULT_USE_NAUTILUS3_FLIST_FORMAT 0 #define DEFAULT_NUM_SILENT_FRAMES_AAC 4 @@ -163,6 +164,10 @@ read_config_chansrv(log_func_t logmsg, break; } } + else if (g_strcasecmp(name, "FuseDirectIO") == 0) + { + cfg->fuse_direct_io = g_text2bool(value); + } else if (g_strcasecmp(name, "FileUmask") == 0) { cfg->file_umask = strtol(value, NULL, 0); @@ -212,6 +217,7 @@ new_config(void) cfg->restrict_outbound_clipboard = DEFAULT_RESTRICT_OUTBOUND_CLIPBOARD; cfg->restrict_inbound_clipboard = DEFAULT_RESTRICT_INBOUND_CLIPBOARD; cfg->fuse_mount_name = fuse_mount_name; + cfg->fuse_direct_io = DEFAULT_FUSE_DIRECT_IO; cfg->file_umask = DEFAULT_FILE_UMASK; cfg->use_nautilus3_flist_format = DEFAULT_USE_NAUTILUS3_FLIST_FORMAT; cfg->num_silent_frames_aac = DEFAULT_NUM_SILENT_FRAMES_AAC; @@ -300,6 +306,8 @@ config_dump(struct config_chansrv *config) g_writeln(" EnableFuseMount %s", g_bool2text(config->enable_fuse_mount)); g_writeln(" FuseMountName: %s", config->fuse_mount_name); + g_writeln(" FuseDirectIO: %s", + g_bool2text(config->fuse_direct_io)); g_writeln(" FileMask: 0%o", config->file_umask); g_writeln(" Nautilus 3 Flist Format: %s", g_bool2text(config->use_nautilus3_flist_format)); diff --git a/sesman/chansrv/chansrv_config.h b/sesman/chansrv/chansrv_config.h index 7a5fbe4c9..a7b30bc69 100644 --- a/sesman/chansrv/chansrv_config.h +++ b/sesman/chansrv/chansrv_config.h @@ -26,6 +26,9 @@ struct config_chansrv /** Whether the FUSE mount is enabled or not */ int enable_fuse_mount; + /** Whether to use direct I/O to FUSE filesystems */ + int fuse_direct_io; + /** RestrictOutboundClipboard setting from sesman.ini */ int restrict_outbound_clipboard; /** RestrictInboundClipboard setting from sesman.ini */ diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c index 826acfec1..0b2203d2b 100644 --- a/sesman/chansrv/chansrv_fuse.c +++ b/sesman/chansrv/chansrv_fuse.c @@ -2200,6 +2200,10 @@ static void xfuse_cb_open(fuse_req_t req, fuse_ino_t ino, fip->fi = *fi; fip->inum = ino; + if (g_cfg->fuse_direct_io) { + fip->fi.direct_io = 1; + } + /* we want path minus 'root node of the share' */ cptr = filename_on_device(full_path); diff --git a/sesman/sesman.ini.in b/sesman/sesman.ini.in index d4b0f6da8..96089a3f1 100644 --- a/sesman/sesman.ini.in +++ b/sesman/sesman.ini.in @@ -173,6 +173,10 @@ FuseMountName=thinclient_drives FileUmask=077 ; Can be used to disable FUSE functionality - see sesman.ini(5) #EnableFuseMount=false +; Can be used to enable direct I/O to FUSE open file calls. This is useful +; when open file handles need to immediately see changes made on the client +; side. There is a performance hit, so use with caution. +#FuseDirectIO=true ; Uncomment this line only if you are using GNOME 3 versions 3.29.92 ; and up, and you wish to cut-paste files between Nautilus and Windows. Do ; not use this setting for GNOME 4, or other file managers