From cfbc0fb48a9880dabe8f332e9bf67d81867ae198 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 3 Jun 2020 11:29:07 -0400 Subject: [PATCH] fuse: update to newer FUSE_USE_VERSION The build was failing for me against fuse-devel v3.9.1. The prototype for fuse_ll_ioctl was wrong, as it was expecting the old-style one with signed int args. In newer libfuse versions, the prototype varies based on FUSE_USE_VERSION. Update to a newer FUSE_USE_VERSION value to ensure that we use the newer ioctl prototype. This also means that we need to handle a new prototype for fuse_session_loop_mt as well. While we're in here, move the definition of FUSE_USE_VERSION to ceph_fuse.h so we have the definition in one place. This does mean we need to reorganize the includes in a few places. Fixes: https://tracker.ceph.com/issues/45866 Signed-off-by: Jeff Layton --- fusetrace/fusetrace_ll.cc | 2 -- src/ceph_fuse.cc | 3 +-- src/client/fuse_ll.cc | 10 ++++++++-- src/client/fuse_ll.h | 2 -- src/include/ceph_fuse.h | 10 +++++++++- src/os/FuseStore.cc | 4 +--- src/rbd_fuse/rbd-fuse.cc | 3 --- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/fusetrace/fusetrace_ll.cc b/fusetrace/fusetrace_ll.cc index b411a83fe20..f10c29fd22e 100644 --- a/fusetrace/fusetrace_ll.cc +++ b/fusetrace/fusetrace_ll.cc @@ -11,8 +11,6 @@ gcc -Wall `pkg-config fuse --cflags --libs` -lulockmgr fusexmp_fh.c -o fusexmp_fh */ -#define FUSE_USE_VERSION 30 - #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/ceph_fuse.cc b/src/ceph_fuse.cc index 02aed32ac69..26bdfbbe9fc 100644 --- a/src/ceph_fuse.cc +++ b/src/ceph_fuse.cc @@ -42,9 +42,8 @@ #include #include -#include -#include #include "include/ceph_fuse.h" +#include #define dout_context g_ceph_context diff --git a/src/client/fuse_ll.cc b/src/client/fuse_ll.cc index 600cfbdd255..3b2118bdcdd 100644 --- a/src/client/fuse_ll.cc +++ b/src/client/fuse_ll.cc @@ -37,7 +37,6 @@ #include "include/ceph_fuse.h" #include "fuse_ll.h" -#include #include #define dout_context g_ceph_context @@ -1262,7 +1261,14 @@ int CephFuse::Handle::loop() auto fuse_multithreaded = client->cct->_conf.get_val( "fuse_multithreaded"); if (fuse_multithreaded) { -#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0) +#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 1) + { + struct fuse_loop_config conf = { 0 }; + + conf.clone_fd = opts.clone_fd; + return fuse_session_loop_mt(se, &conf); + } +#elif FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0) return fuse_session_loop_mt(se, opts.clone_fd); #else return fuse_session_loop_mt(se); diff --git a/src/client/fuse_ll.h b/src/client/fuse_ll.h index 3d7b891ddb4..85e587baf46 100644 --- a/src/client/fuse_ll.h +++ b/src/client/fuse_ll.h @@ -12,8 +12,6 @@ * */ -#define FUSE_USE_VERSION 30 - class CephFuse { public: CephFuse(Client *c, int fd); diff --git a/src/include/ceph_fuse.h b/src/include/ceph_fuse.h index ae504f6715d..c95fd19408c 100644 --- a/src/include/ceph_fuse.h +++ b/src/include/ceph_fuse.h @@ -14,7 +14,15 @@ #ifndef CEPH_FUSE_H #define CEPH_FUSE_H -#define FUSE_USE_VERSION 30 +/* + * The API version that we want to use, regardless of what the + * library version is. Note that this must be defined before + * fuse.h is included. + */ +#ifndef FUSE_USE_VERSION +#define FUSE_USE_VERSION 35 +#endif + #include #include "acconfig.h" diff --git a/src/os/FuseStore.cc b/src/os/FuseStore.cc index 35755f737f1..8845d9f0806 100644 --- a/src/os/FuseStore.cc +++ b/src/os/FuseStore.cc @@ -2,15 +2,13 @@ // vim: ts=8 sw=2 smarttab #include "include/compat.h" +#include "include/ceph_fuse.h" #include "FuseStore.h" #include "os/ObjectStore.h" #include "include/stringify.h" #include "common/errno.h" -#define FUSE_USE_VERSION 30 -#include #include -#include "include/ceph_fuse.h" #include #include diff --git a/src/rbd_fuse/rbd-fuse.cc b/src/rbd_fuse/rbd-fuse.cc index e7c8166542a..6d6db311929 100644 --- a/src/rbd_fuse/rbd-fuse.cc +++ b/src/rbd_fuse/rbd-fuse.cc @@ -1,8 +1,6 @@ /* * rbd-fuse */ -#define FUSE_USE_VERSION 30 - #include "include/int_types.h" #include @@ -11,7 +9,6 @@ #include #include #include -#include #include #include #include -- 2.39.5