mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
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@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Sep 25 00:48:45 UTC 2019 on sn-devel-184
This commit is contained in:
parent
929555b7c8
commit
517ec63004
@ -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>
|
||||
|
||||
|
@ -288,6 +288,12 @@ static uint64_t fileid_extid_mapping_zero(struct fileid_handle_data *data,
|
||||
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)
|
||||
{
|
||||
@ -370,6 +376,17 @@ static int fileid_connect(struct vfs_handle_struct *handle,
|
||||
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) {
|
||||
saved_errno = errno;
|
||||
|
Loading…
Reference in New Issue
Block a user