[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Sep 25 00:49:03 UTC 2019


The branch, master has been updated
       via  517ec63004f vfs_fileid: add "fsname_norootdir_ext" option
       via  929555b7c8e vfs_fileid: add extid mapping hooks
      from  0ee085b5948 selftest/Samba3.pm: use "winbind use krb5 enterprise principals = yes" for ad_member

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


- Log -----------------------------------------------------------------
commit 517ec63004f6708c9e6b29cb33bd789b1936997b
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Sep 3 15:33:42 2019 +0200

    vfs_fileid: add "fsname_norootdir_ext" option
    
    This can be used to deliberately break lock coherency between all smbd processes
    in the whole cluster for the root directory of a share.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Sep 25 00:48:45 UTC 2019 on sn-devel-184

commit 929555b7c8e987a98b704c102323546a2034bea7
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Sep 12 14:36:17 2019 +0200

    vfs_fileid: add extid mapping hooks
    
    For this always ends up calling fileid_extid_mapping_zero(), so no change in
    behaviour. This will change in a subsequent commit.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

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

Summary of changes:
 docs-xml/manpages/vfs_fileid.8.xml |  8 ++++++++
 source3/modules/vfs_fileid.c       | 35 +++++++++++++++++++++++++++++++++--
 2 files changed, 41 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_fileid.8.xml b/docs-xml/manpages/vfs_fileid.8.xml
index 8ab1e30c490..defb71229e9 100644
--- a/docs-xml/manpages/vfs_fileid.8.xml
+++ b/docs-xml/manpages/vfs_fileid.8.xml
@@ -87,6 +87,14 @@
 		algorithm. This can be used to deliberately break lock coherency
 		in a cluster for the root directory of a share.
 		</para>
+		<para>The <command>fsname_norootdir_ext</command> algorithm
+		generates device ids by hashing the kernel device name, except
+		for the root directory of shares where it will use the hostname
+		algorithm. Additionally it generates an extid based on the
+		process pid. This can be used to deliberately break lock
+		coherency between all smbd processes in the whole cluster for
+		the root directory of a share.
+		</para>
 		</listitem>
 		</varlistentry>
 
diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c
index cd6f9c30cf3..d7e9090bc18 100644
--- a/source3/modules/vfs_fileid.c
+++ b/source3/modules/vfs_fileid.c
@@ -38,6 +38,8 @@ struct fileid_mount_entry {
 struct fileid_handle_data {
 	uint64_t (*device_mapping_fn)(struct fileid_handle_data *data,
 				      const SMB_STRUCT_STAT *sbuf);
+	uint64_t (*extid_mapping_fn)(struct fileid_handle_data *data,
+				      const SMB_STRUCT_STAT *sbuf);
 	char **fstype_deny_list;
 	char **fstype_allow_list;
 	char **mntdir_deny_list;
@@ -280,6 +282,18 @@ static uint64_t fileid_device_mapping_fsid(struct fileid_handle_data *data,
 	return m->devid;
 }
 
+static uint64_t fileid_extid_mapping_zero(struct fileid_handle_data *data,
+					  const SMB_STRUCT_STAT *sbuf)
+{
+	return 0;
+}
+
+static uint64_t fileid_extid_mapping_pid(struct fileid_handle_data *data,
+					 const SMB_STRUCT_STAT *sbuf)
+{
+	return getpid();
+}
+
 static int get_connectpath_ino(struct vfs_handle_struct *handle,
 			       ino_t *ino)
 {
@@ -348,14 +362,30 @@ static int fileid_connect(struct vfs_handle_struct *handle,
 					 algorithm);
 	if (strcmp("fsname", algorithm) == 0) {
 		data->device_mapping_fn	= fileid_device_mapping_fsname;
+		data->extid_mapping_fn = fileid_extid_mapping_zero;
 	} else if (strcmp("fsname_nodirs", algorithm) == 0) {
 		data->device_mapping_fn = fileid_device_mapping_fsname_nodirs;
+		data->extid_mapping_fn = fileid_extid_mapping_zero;
 	} else if (strcmp("fsid", algorithm) == 0) {
 		data->device_mapping_fn	= fileid_device_mapping_fsid;
+		data->extid_mapping_fn = fileid_extid_mapping_zero;
 	} else if (strcmp("hostname", algorithm) == 0) {
 		data->device_mapping_fn = fileid_device_mapping_hostname;
+		data->extid_mapping_fn = fileid_extid_mapping_zero;
 	} else if (strcmp("fsname_norootdir", algorithm) == 0) {
 		data->device_mapping_fn	= fileid_device_mapping_fsname;
+		data->extid_mapping_fn = fileid_extid_mapping_zero;
+
+		ret = get_connectpath_ino(handle, &data->nolockinode);
+		if (ret != 0) {
+			saved_errno = errno;
+			SMB_VFS_NEXT_DISCONNECT(handle);
+			errno = saved_errno;
+			return -1;
+		}
+	} else if (strcmp("fsname_norootdir_ext", algorithm) == 0) {
+		data->device_mapping_fn	= fileid_device_mapping_fsname;
+		data->extid_mapping_fn = fileid_extid_mapping_pid;
 
 		ret = get_connectpath_ino(handle, &data->nolockinode);
 		if (ret != 0) {
@@ -459,6 +489,7 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle,
 	if ((data->nolockinode != 0) &&
 	    (sbuf->st_ex_ino == data->nolockinode)) {
 		devid = fileid_device_mapping_hostname(data, sbuf);
+		id.extid = data->extid_mapping_fn(data, sbuf);
 	} else {
 		devid = data->device_mapping_fn(data, sbuf);
 	}
@@ -466,8 +497,8 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle,
 	id.inode	= sbuf->st_ex_ino;
 	id.devid        = devid;
 
-	DBG_DEBUG("Returning dev [%jx] inode [%jx]\n",
-		  (uintmax_t)id.devid, (uintmax_t)id.inode);
+	DBG_DEBUG("Returning dev [%jx] inode [%jx] extid [%jx]\n",
+		  (uintmax_t)id.devid, (uintmax_t)id.inode, (uintmax_t)id.extid);
 
 	return id;
 }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list