Skip to content

Commit

Permalink
Merge pull request #3255 from bobcarroll/fuse-direct-io
Browse files Browse the repository at this point in the history
add option to enable FUSE direct i/o on file open
  • Loading branch information
matt335672 committed Sep 25, 2024
2 parents d4c30d5 + 89a4a1b commit 6599331
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/man/sesman.ini.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ the user).
drive. To fix this, consult the docs for your chosen desktop.
.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
\fBFileUmask\fR=\fImode\fR
Additional umask to apply to files in the \fBFuseMountName\fR directory.
Expand Down
8 changes: 8 additions & 0 deletions sesman/chansrv/chansrv_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
3 changes: 3 additions & 0 deletions sesman/chansrv/chansrv_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
5 changes: 5 additions & 0 deletions sesman/chansrv/chansrv_fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2200,6 +2200,11 @@ 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);

Expand Down
4 changes: 4 additions & 0 deletions sesman/sesman.ini.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6599331

Please sign in to comment.