[glib/wip/oholy/cifs-splice] gfile: Prevent hangs when copying on CIFS
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/oholy/cifs-splice] gfile: Prevent hangs when copying on CIFS
- Date: Tue, 23 Apr 2019 13:58:15 +0000 (UTC)
commit 4b3a10dd20a1a2e4be1fcb5b37a7affa573af45b
Author: Ondrej Holy <oholy redhat com>
Date: Tue Apr 23 13:31:59 2019 +0200
gfile: Prevent hangs when copying on CIFS
Prevent usage of splice() on CIFS as it causes hangs in some cases,
see https://bugzilla.kernel.org/show_bug.cgi?id=198349 for more info.
Closes: https://gitlab.gnome.org/GNOME/glib/issues/1246
gio/gfile.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index 24b136d80..96f7aedd0 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -3188,6 +3188,8 @@ file_copy_fallback (GFile *source,
const char *target;
char *attrs_to_read;
gboolean do_set_attributes = FALSE;
+ GFileInfo *fs_info = NULL;
+ const gchar *fs_type = NULL;
/* need to know the file type */
info = g_file_query_info (source,
@@ -3336,7 +3338,18 @@ file_copy_fallback (GFile *source,
#endif
#ifdef HAVE_SPLICE
- if (G_IS_FILE_DESCRIPTOR_BASED (in) && G_IS_FILE_DESCRIPTOR_BASED (out))
+ fs_info = g_file_query_filesystem_info (source,
+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+ cancellable,
+ error);
+ fs_type = g_file_info_get_attribute_string (fs_info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
+
+ /* Prevent usage of splice() on CIFS as it causes hangs in some cases, see:
+ * https://bugzilla.kernel.org/show_bug.cgi?id=198349
+ */
+ if (g_strcmp0 (fs_type, "cifs") != 0 &&
+ G_IS_FILE_DESCRIPTOR_BASED (in) && G_IS_FILE_DESCRIPTOR_BASED (out))
{
GError *splice_err = NULL;
@@ -3398,6 +3411,7 @@ file_copy_fallback (GFile *source,
}
g_clear_object (&info);
+ g_clear_object (&fs_info);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]