[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Mon Oct 7 13:37:02 UTC 2024


The branch, master has been updated
       via  3c6ca81aad1 vfs_glusterfs: Retrieve fs capabilities using vfs_get_fs_capabilities
       via  9524b402f81 vfs_ceph_new: Retrieve fs capabilties using vfs_get_fs_capabilities
       via  58cf7a63209 vfs_ceph_new: Populate fs capabilities within vfs_ceph_statvfs
       via  44e4e1eade5 vfs_ceph: Retrieve fs capabilties using vfs_get_fs_capabilities
       via  0d922d06a71 vfs_ceph: Populate fs capabilities within cephwrap_statvfs
       via  9bced4429e9 vfs_default: Retrieve fs capabilites using vfs_get_fs_capabilties
       via  b1fbaefc665 s3/smbd: Add a helper to fetch fs capabilities
      from  250947611c7 ctdb-tests: Fix test failure when tests are installed

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3c6ca81aad16e74bc3d9c4784baf97a237f652c6
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Sep 17 23:58:50 2024 +0530

    vfs_glusterfs: Retrieve fs capabilities using vfs_get_fs_capabilities
    
    vfs_glusterfs is supposed to be the last entry when listed with
    other vfs modules. This is due to the fact that the connection path
    is not local to the server but relative to the virtual remote file
    system beneath it. Especially SMB_VFS_FS_CAPABILITIES implementation
    from vfs_default is likely to return incorrect results based on the
    connection path assumed to be local to the server which might not be
    the case with glusterfs module stacked. Therefore it doesn't make sense
    to pass through any vfs interface implementations further down the line
    to vfs_default.
    
    Instead make use of get_fs_capabilties to start with already known fs
    capabilties from connect phase.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Mon Oct  7 13:36:11 UTC 2024 on atb-devel-224

commit 9524b402f811fd2fc35c9952df0496898f8e2cbe
Author: Anoop C S <anoopcs at samba.org>
Date:   Thu Oct 3 12:32:04 2024 +0530

    vfs_ceph_new: Retrieve fs capabilties using vfs_get_fs_capabilities
    
    Make use of get_fs_capabilties to start with already known fs
    capabilties from connect phase.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 58cf7a63209b0a898bc39c9f8b7de5188bef618f
Author: Anoop C S <anoopcs at samba.org>
Date:   Thu Oct 3 12:29:58 2024 +0530

    vfs_ceph_new: Populate fs capabilities within vfs_ceph_statvfs
    
    SMB_VFS_STATVFS implementation for vfs_ceph_new failed to fill in the
    FsCapabilities field for vfs_statvfs_struct. Insert the minimum
    required values for defining the capabilties of a ceph file system.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 44e4e1eade5cadea9bd93fde8293ab6eb26230cc
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Sep 17 23:50:25 2024 +0530

    vfs_ceph: Retrieve fs capabilties using vfs_get_fs_capabilities
    
    vfs_ceph is supposed to be the last entry when listed with other vfs
    modules. This is due to the fact that the connection path is not local
    to the server but relative to the virtual remote file system beneath
    it. Especially SMB_VFS_FS_CAPABILITIES implementation from vfs_default
    is likely to return incorrect results based on the connection path
    assumed to be local to the server which might not be the case with
    ceph module stacked. Therefore it doesn't make sense to pass through
    any vfs interface implementations further down the line to vfs_default.
    
    Instead make use of get_fs_capabilties to start with already known fs
    capabilties from connect phase.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 0d922d06a71ad647791cd93194c5591033fc4b4b
Author: Anoop C S <anoopcs at samba.org>
Date:   Mon Sep 23 14:55:59 2024 +0530

    vfs_ceph: Populate fs capabilities within cephwrap_statvfs
    
    SMB_VFS_STATVFS implementation for vfs_ceph failed to fill in the
    FsCapabilities field for vfs_statvfs_struct. Insert the minimum
    required values for defining the capabilties of a ceph file system.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 9bced4429e90ba871b848f31738aa8614bf03b08
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Sep 24 11:25:54 2024 +0530

    vfs_default: Retrieve fs capabilites using vfs_get_fs_capabilties
    
    Make use of get_fs_capabilties to start with already known fs
    capabilties from connect phase.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b1fbaefc665a7fb0413a26bd0304f97356fda414
Author: Anoop C S <anoopcs at samba.org>
Date:   Tue Sep 24 11:06:58 2024 +0530

    s3/smbd: Add a helper to fetch fs capabilities
    
    We create a new helper function to retrieve the fs capabilties via
    STATVFS call. Additionally set other capabilities based on specific
    parametric options. This is 99.9% taken from SMB_VFS_FS_CAPABILITIES
    implementation of vfs_default in preparation to be called from any
    required vfs module.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15716
    
    Signed-off-by: Anoop C S <anoopcs at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_ceph.c      |  8 ++---
 source3/modules/vfs_ceph_new.c  |  7 ++--
 source3/modules/vfs_default.c   | 67 +-------------------------------------
 source3/modules/vfs_glusterfs.c |  8 +----
 source3/smbd/proto.h            |  2 ++
 source3/smbd/vfs.c              | 72 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 84 insertions(+), 80 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index 26b51ac78c5..49cbd17692f 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -363,6 +363,9 @@ static int cephwrap_statvfs(struct vfs_handle_struct *handle,
 	statbuf->TotalFileNodes = statvfs_buf.f_files;
 	statbuf->FreeFileNodes = statvfs_buf.f_ffree;
 	statbuf->FsIdentifier = statvfs_buf.f_fsid;
+	statbuf->FsCapabilities =
+		FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+
 	DBG_DEBUG("[CEPH] f_bsize: %ld, f_blocks: %ld, f_bfree: %ld, "
 		  "f_bavail: %ld\n",
 		  (long int)statvfs_buf.f_bsize,
@@ -377,10 +380,7 @@ static uint32_t cephwrap_fs_capabilities(
 	struct vfs_handle_struct *handle,
 	enum timestamp_set_resolution *p_ts_res)
 {
-	uint32_t caps;
-
-	caps = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
-	*p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
+	uint32_t caps = vfs_get_fs_capabilities(handle->conn, p_ts_res);
 
 	return caps;
 }
diff --git a/source3/modules/vfs_ceph_new.c b/source3/modules/vfs_ceph_new.c
index 53f673583fe..c33b715e8cb 100644
--- a/source3/modules/vfs_ceph_new.c
+++ b/source3/modules/vfs_ceph_new.c
@@ -1903,6 +1903,9 @@ static int vfs_ceph_statvfs(struct vfs_handle_struct *handle,
 	statbuf->TotalFileNodes = statvfs_buf.f_files;
 	statbuf->FreeFileNodes = statvfs_buf.f_ffree;
 	statbuf->FsIdentifier = statvfs_buf.f_fsid;
+	statbuf->FsCapabilities =
+		FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+
 	DBG_DEBUG("[CEPH] f_bsize: %ld, f_blocks: %ld, f_bfree: %ld, "
 		  "f_bavail: %ld\n",
 		  (long int)statvfs_buf.f_bsize,
@@ -1918,9 +1921,7 @@ static uint32_t vfs_ceph_fs_capabilities(
 	struct vfs_handle_struct *handle,
 	enum timestamp_set_resolution *p_ts_res)
 {
-	uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
-
-	*p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
+	uint32_t caps = vfs_get_fs_capabilities(handle->conn, p_ts_res);
 
 	return caps;
 }
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 5922aba3e8a..e895de189fa 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -153,77 +153,12 @@ static int vfswrap_statvfs(struct vfs_handle_struct *handle,
 static uint32_t vfswrap_fs_capabilities(struct vfs_handle_struct *handle,
 		enum timestamp_set_resolution *p_ts_res)
 {
-	const struct loadparm_substitution *lp_sub =
-		loadparm_s3_global_substitution();
-	connection_struct *conn = handle->conn;
-	uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
-	struct smb_filename *smb_fname_cpath = NULL;
-	struct vfs_statvfs_struct statbuf;
-	int ret;
-
-	smb_fname_cpath = synthetic_smb_fname(talloc_tos(),
-					      conn->connectpath,
-					      NULL,
-					      NULL,
-					      0,
-					      0);
-	if (smb_fname_cpath == NULL) {
-		return caps;
-	}
-
-	ZERO_STRUCT(statbuf);
-	ret = SMB_VFS_STATVFS(conn, smb_fname_cpath, &statbuf);
-	if (ret == 0) {
-		caps = statbuf.FsCapabilities;
-	}
+	uint32_t caps = vfs_get_fs_capabilities(handle->conn, p_ts_res);
 
 #if defined(HAVE_SYS_QUOTAS)
 	caps |= FILE_VOLUME_QUOTAS;
 #endif
 
-	if (lp_nt_acl_support(SNUM(conn))) {
-		caps |= FILE_PERSISTENT_ACLS;
-	}
-
-	caps |= lp_parm_int(SNUM(conn), "share", "fake_fscaps", 0);
-
-	*p_ts_res = TIMESTAMP_SET_SECONDS;
-
-	/* Work out what timestamp resolution we can
-	 * use when setting a timestamp. */
-
-	ret = SMB_VFS_STAT(conn, smb_fname_cpath);
-	if (ret == -1) {
-		TALLOC_FREE(smb_fname_cpath);
-		return caps;
-	}
-
-	if (smb_fname_cpath->st.st_ex_mtime.tv_nsec ||
-			smb_fname_cpath->st.st_ex_atime.tv_nsec ||
-			smb_fname_cpath->st.st_ex_ctime.tv_nsec) {
-		/* If any of the normal UNIX directory timestamps
-		 * have a non-zero tv_nsec component assume
-		 * we might be able to set sub-second timestamps.
-		 * See what filetime set primitives we have.
-		 */
-#if defined(HAVE_UTIMENSAT)
-		*p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
-#elif defined(HAVE_UTIMES)
-		/* utimes allows msec timestamps to be set. */
-		*p_ts_res = TIMESTAMP_SET_MSEC;
-#elif defined(HAVE_UTIME)
-		/* utime only allows sec timestamps to be set. */
-		*p_ts_res = TIMESTAMP_SET_SECONDS;
-#endif
-
-		DBG_DEBUG("vfswrap_fs_capabilities: timestamp "
-			"resolution of %s "
-			"available on share %s, directory %s\n",
-			*p_ts_res == TIMESTAMP_SET_MSEC ? "msec" : "sec",
-			lp_servicename(talloc_tos(), lp_sub, conn->params->service),
-			conn->connectpath );
-	}
-	TALLOC_FREE(smb_fname_cpath);
 	return caps;
 }
 
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 2ac978eed8c..48a76189096 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -594,18 +594,12 @@ static int vfs_gluster_statvfs(struct vfs_handle_struct *handle,
 static uint32_t vfs_gluster_fs_capabilities(struct vfs_handle_struct *handle,
 					    enum timestamp_set_resolution *p_ts_res)
 {
-	uint32_t caps;
-
-	caps = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
+	uint32_t caps = vfs_get_fs_capabilities(handle->conn, p_ts_res);
 
 #ifdef HAVE_GFAPI_VER_6
 	caps |= FILE_SUPPORTS_SPARSE_FILES;
 #endif
 
-#ifdef STAT_HAVE_NSEC
-	*p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
-#endif
-
 	return caps;
 }
 
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 0661afea1c2..15262d07fab 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1171,6 +1171,8 @@ NTSTATUS vfs_fstreaminfo(struct files_struct *fsp,
 void init_smb_file_time(struct smb_file_time *ft);
 int vfs_fake_fd(void);
 int vfs_fake_fd_close(int fd);
+uint32_t vfs_get_fs_capabilities(struct connection_struct *conn,
+				 enum timestamp_set_resolution *ts_res);
 
 /* The following definitions come from smbd/avahi_register.c */
 
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index fe90d30f45f..ce9c9af3fd2 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1300,6 +1300,78 @@ NTSTATUS vfs_at_fspcwd(TALLOC_CTX *mem_ctx,
 	return NT_STATUS_OK;
 }
 
+uint32_t vfs_get_fs_capabilities(struct connection_struct *conn,
+				 enum timestamp_set_resolution *ts_res)
+{
+	const struct loadparm_substitution *lp_sub =
+		loadparm_s3_global_substitution();
+	uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
+	struct smb_filename *smb_fname_cpath = NULL;
+	struct vfs_statvfs_struct statbuf;
+	int ret;
+
+	smb_fname_cpath = synthetic_smb_fname(talloc_tos(),
+					      conn->connectpath,
+					      NULL,
+					      NULL,
+					      0,
+					      0);
+	if (smb_fname_cpath == NULL) {
+		return caps;
+	}
+
+	ZERO_STRUCT(statbuf);
+	ret = SMB_VFS_STATVFS(conn, smb_fname_cpath, &statbuf);
+	if (ret == 0) {
+		caps = statbuf.FsCapabilities;
+	}
+
+	if (lp_nt_acl_support(SNUM(conn))) {
+		caps |= FILE_PERSISTENT_ACLS;
+	}
+
+	caps |= lp_parm_int(SNUM(conn), "share", "fake_fscaps", 0);
+
+	*ts_res = TIMESTAMP_SET_SECONDS;
+
+	/* Work out what timestamp resolution we can
+	 * use when setting a timestamp. */
+
+	ret = SMB_VFS_STAT(conn, smb_fname_cpath);
+	if (ret == -1) {
+		TALLOC_FREE(smb_fname_cpath);
+		return caps;
+	}
+
+	if (smb_fname_cpath->st.st_ex_mtime.tv_nsec ||
+			smb_fname_cpath->st.st_ex_atime.tv_nsec ||
+			smb_fname_cpath->st.st_ex_ctime.tv_nsec) {
+		/* If any of the normal UNIX directory timestamps
+		 * have a non-zero tv_nsec component assume
+		 * we might be able to set sub-second timestamps.
+		 * See what filetime set primitives we have.
+		 */
+#if defined(HAVE_UTIMENSAT)
+		*ts_res = TIMESTAMP_SET_NT_OR_BETTER;
+#elif defined(HAVE_UTIMES)
+		/* utimes allows msec timestamps to be set. */
+		*ts_res = TIMESTAMP_SET_MSEC;
+#elif defined(HAVE_UTIME)
+		/* utime only allows sec timestamps to be set. */
+		*ts_res = TIMESTAMP_SET_SECONDS;
+#endif
+
+		DBG_DEBUG("vfs_get_fs_capabilities: timestamp "
+			  "resolution of %s "
+			  "available on share %s, directory %s\n",
+			  *ts_res == TIMESTAMP_SET_MSEC ? "msec" : "sec",
+			  lp_servicename(talloc_tos(), lp_sub, conn->params->service),
+			  conn->connectpath );
+	}
+	TALLOC_FREE(smb_fname_cpath);
+	return caps;
+}
+
 static struct smb_vfs_deny_state *smb_vfs_deny_global;
 
 void smb_vfs_assert_allowed(void)


-- 
Samba Shared Repository



More information about the samba-cvs mailing list