Merge pull request #3255 from bobcarroll/fuse-direct-io

add option to enable FUSE direct i/o on file open
This commit is contained in:
matt335672 2024-09-25 10:06:46 +01:00 committed by GitHub
commit 65993312b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 26 additions and 0 deletions

View File

@ -354,6 +354,12 @@ the user).
drive. To fix this, consult the docs for your chosen desktop. drive. To fix this, consult the docs for your chosen desktop.
.RE .RE
.TP
\fBFuseDirectIO\fR=\fI[false|true]\fR
Defaults to \fIfalse\fR. Set to \fItrue\fR to disable page caching in
FUSE when opening files on a redirected drive. Direct I/O can impact
the performance of file operations.
.TP .TP
\fBFileUmask\fR=\fImode\fR \fBFileUmask\fR=\fImode\fR
Additional umask to apply to files in the \fBFuseMountName\fR directory. Additional umask to apply to files in the \fBFuseMountName\fR directory.

View File

@ -40,6 +40,7 @@
#define DEFAULT_RESTRICT_INBOUND_CLIPBOARD 0 #define DEFAULT_RESTRICT_INBOUND_CLIPBOARD 0
#define DEFAULT_ENABLE_FUSE_MOUNT 1 #define DEFAULT_ENABLE_FUSE_MOUNT 1
#define DEFAULT_FUSE_MOUNT_NAME "xrdp-client" #define DEFAULT_FUSE_MOUNT_NAME "xrdp-client"
#define DEFAULT_FUSE_DIRECT_IO 0
#define DEFAULT_FILE_UMASK 077 #define DEFAULT_FILE_UMASK 077
#define DEFAULT_USE_NAUTILUS3_FLIST_FORMAT 0 #define DEFAULT_USE_NAUTILUS3_FLIST_FORMAT 0
#define DEFAULT_NUM_SILENT_FRAMES_AAC 4 #define DEFAULT_NUM_SILENT_FRAMES_AAC 4
@ -163,6 +164,10 @@ read_config_chansrv(log_func_t logmsg,
break; break;
} }
} }
else if (g_strcasecmp(name, "FuseDirectIO") == 0)
{
cfg->fuse_direct_io = g_text2bool(value);
}
else if (g_strcasecmp(name, "FileUmask") == 0) else if (g_strcasecmp(name, "FileUmask") == 0)
{ {
cfg->file_umask = strtol(value, NULL, 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_outbound_clipboard = DEFAULT_RESTRICT_OUTBOUND_CLIPBOARD;
cfg->restrict_inbound_clipboard = DEFAULT_RESTRICT_INBOUND_CLIPBOARD; cfg->restrict_inbound_clipboard = DEFAULT_RESTRICT_INBOUND_CLIPBOARD;
cfg->fuse_mount_name = fuse_mount_name; cfg->fuse_mount_name = fuse_mount_name;
cfg->fuse_direct_io = DEFAULT_FUSE_DIRECT_IO;
cfg->file_umask = DEFAULT_FILE_UMASK; cfg->file_umask = DEFAULT_FILE_UMASK;
cfg->use_nautilus3_flist_format = DEFAULT_USE_NAUTILUS3_FLIST_FORMAT; cfg->use_nautilus3_flist_format = DEFAULT_USE_NAUTILUS3_FLIST_FORMAT;
cfg->num_silent_frames_aac = DEFAULT_NUM_SILENT_FRAMES_AAC; 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_writeln(" EnableFuseMount %s",
g_bool2text(config->enable_fuse_mount)); g_bool2text(config->enable_fuse_mount));
g_writeln(" FuseMountName: %s", config->fuse_mount_name); 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(" FileMask: 0%o", config->file_umask);
g_writeln(" Nautilus 3 Flist Format: %s", g_writeln(" Nautilus 3 Flist Format: %s",
g_bool2text(config->use_nautilus3_flist_format)); g_bool2text(config->use_nautilus3_flist_format));

View File

@ -26,6 +26,9 @@ struct config_chansrv
/** Whether the FUSE mount is enabled or not */ /** Whether the FUSE mount is enabled or not */
int enable_fuse_mount; int enable_fuse_mount;
/** Whether to use direct I/O to FUSE filesystems */
int fuse_direct_io;
/** RestrictOutboundClipboard setting from sesman.ini */ /** RestrictOutboundClipboard setting from sesman.ini */
int restrict_outbound_clipboard; int restrict_outbound_clipboard;
/** RestrictInboundClipboard setting from sesman.ini */ /** RestrictInboundClipboard setting from sesman.ini */

View File

@ -2200,6 +2200,11 @@ static void xfuse_cb_open(fuse_req_t req, fuse_ino_t ino,
fip->fi = *fi; fip->fi = *fi;
fip->inum = ino; fip->inum = ino;
if (g_cfg->fuse_direct_io)
{
fip->fi.direct_io = 1;
}
/* we want path minus 'root node of the share' */ /* we want path minus 'root node of the share' */
cptr = filename_on_device(full_path); cptr = filename_on_device(full_path);

View File

@ -173,6 +173,10 @@ FuseMountName=thinclient_drives
FileUmask=077 FileUmask=077
; Can be used to disable FUSE functionality - see sesman.ini(5) ; Can be used to disable FUSE functionality - see sesman.ini(5)
#EnableFuseMount=false #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 ; 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 ; 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 ; not use this setting for GNOME 4, or other file managers