From: Ralph Boehme Date: Thu, 4 Jan 2018 16:09:21 +0000 (+0100) Subject: vfs_fileid: add fileid:nolockinode parameter X-Git-Tag: talloc-2.1.11~53 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1468dd21c37445cff044583229b107254d53b2b9;p=thirdparty%2Fsamba.git vfs_fileid: add fileid:nolockinode parameter Based-on-a-patch-by: Ralph Wuerthner Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/docs-xml/manpages/vfs_fileid.8.xml b/docs-xml/manpages/vfs_fileid.8.xml index 9e8becb6b0c..78f054aa0e5 100644 --- a/docs-xml/manpages/vfs_fileid.8.xml +++ b/docs-xml/manpages/vfs_fileid.8.xml @@ -132,6 +132,16 @@ + + fileid:nolockinode + + This option triggers use of the fileid hostname algorithm + for the configured inode which can be used to deliberately break + lock coherency for the corresponding file or directory in a + cluster. + + + diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c index 4752bc55286..bac8ff08731 100644 --- a/source3/modules/vfs_fileid.c +++ b/source3/modules/vfs_fileid.c @@ -44,6 +44,7 @@ struct fileid_handle_data { char **mntdir_allow_list; unsigned num_mount_entries; struct fileid_mount_entry *mount_entries; + ino_t nolockinode; }; /* check if a mount entry is allowed based on fstype and mount directory */ @@ -378,6 +379,9 @@ static int fileid_connect(struct vfs_handle_struct *handle, } } + data->nolockinode = lp_parm_ulong(SNUM(handle->conn), "fileid", + "nolockinode", 0); + SMB_VFS_HANDLE_SET_DATA(handle, data, NULL, struct fileid_handle_data, return -1); @@ -401,6 +405,7 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle, { struct fileid_handle_data *data; struct file_id id; + uint64_t devid; ZERO_STRUCT(id); @@ -408,8 +413,14 @@ static struct file_id fileid_file_id_create(struct vfs_handle_struct *handle, struct fileid_handle_data, return id); - id.devid = data->device_mapping_fn(data, sbuf); + if ((data->nolockinode != 0) && (id.inode == data->nolockinode)) { + devid = fileid_device_mapping_hostname(data, sbuf); + } else { + devid = data->device_mapping_fn(data, sbuf); + } + 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);