Add FUSE_CAP_NO_EXPORT and use it in passthrough_hp
authorBernd Schubert <bschubert@ddn.com>
Thu, 19 Sep 2024 13:09:04 +0000 (15:09 +0200)
committerBernd Schubert <bernd.schubert@fastmail.fm>
Wed, 13 Nov 2024 15:43:59 +0000 (16:43 +0100)
This should stop some more xfstest test failures.

example/passthrough_hp.cc
example/printcap.c
include/fuse_common.h
lib/fuse_lowlevel.c

index 1f6647fc69773918b13e8ca05781b05ceac72207..c393f043fa6f033a24ff09edac22db6d5bc02141 100644 (file)
@@ -214,6 +214,16 @@ static void sfs_init(void *userdata, fuse_conn_info *conn) {
     /* This is a local file system - no network coherency needed */
     fuse_set_feature_flag(conn, FUSE_CAP_DIRECT_IO_ALLOW_MMAP);
 
+    /* Disable NFS export support, which also disabled name_to_handle_at.
+     * Goal is to make xfstests that test name_to_handle_at to fail with
+     * the right error code (EOPNOTSUPP) than to open_by_handle_at to fail with
+     * ESTALE and let those test fail.
+     * Perfect NFS export support is not possible with this FUSE filesystem needs
+     * more kernel work, in order to passthrough nfs handle encode/decode to
+     * fuse-server/daemon.
+     */
+    fuse_set_feature_flag(conn, FUSE_CAP_NO_EXPORT_SUPPORT);
+
     /* Disable the receiving and processing of FUSE_INTERRUPT requests */
     conn->no_interrupt = 1;
 }
index bbbc1b899ef06f5d5fbbe401498890f106db94ba..01b4d3f8365ae15d51123028a3a13f0069fe6009 100644 (file)
@@ -88,7 +88,9 @@ static void pc_init(void *userdata,
        if(conn->capable & FUSE_CAP_HANDLE_KILLPRIV_V2)
                        printf("\tFUSE_CAP_HANDLE_KILLPRIV_V2\n");
        if(conn->capable & FUSE_CAP_DIRECT_IO_ALLOW_MMAP)
-                       printf("\tFUSE_CAP_DIRECT_IO_ALLOW_MMAP\n");
+               printf("\tFUSE_CAP_DIRECT_IO_ALLOW_MMAP\n");
+       if (conn->capable & FUSE_CAP_NO_EXPORT_SUPPORT)
+               printf("\tFUSE_CAP_NO_EXPORT_SUPPORT\n");
        fuse_session_exit(se);
 }
 
index 1abac5af9cf675d3bcb6e704dd00075e13ad8108..85f0b23044750b3333ce9bd60c3791663ce6b2b5 100644 (file)
@@ -494,6 +494,14 @@ struct fuse_loop_config_v1 {
  */
 #define FUSE_CAP_PASSTHROUGH      (1 << 29)
 
+/**
+ * Indicates that the file system cannot handle NFS export
+ *
+ * If this flag is set NFS export and name_to_handle_at
+ * is not going to work at all and will fail with EOPNOTSUPP.
+ */
+#define FUSE_CAP_NO_EXPORT_SUPPORT  (1 << 30)
+
 /**
  * Ioctl flags
  *
index 220a2639519094eb5f8288b0d821ee3a3ce973ba..35dc3ca509e64160a8f7d9d7ec7bff8bcd1cc3ac 100644 (file)
@@ -2081,6 +2081,8 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
                        se->conn.capable |= FUSE_CAP_EXPIRE_ONLY;
                if (inargflags & FUSE_PASSTHROUGH)
                        se->conn.capable |= FUSE_CAP_PASSTHROUGH;
+               if (inargflags & FUSE_NO_EXPORT_SUPPORT)
+                       se->conn.capable |= FUSE_CAP_NO_EXPORT_SUPPORT;
        } else {
                se->conn.max_readahead = 0;
        }
@@ -2217,6 +2219,8 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
                 */
                outarg.max_stack_depth = se->conn.max_backing_stack_depth + 1;
        }
+       if (se->conn.want & FUSE_CAP_NO_EXPORT_SUPPORT)
+               outargflags |= FUSE_NO_EXPORT_SUPPORT;
 
        if (inargflags & FUSE_INIT_EXT) {
                outargflags |= FUSE_INIT_EXT;