mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
vfs_fileid: add fileid:algorithm = fsname_nodirs
Enabling fileid:algorithm = fsname_nodirs uses the hostname algorithm for directories and thus breaks cluster lock coherence for directories. Based-on-a-patch-by: Christian Ambach <ambi@samba.org> Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
495c646ec5
commit
b599cb2168
@ -61,12 +61,18 @@
|
||||
<term>fileid:algorithm = ALGORITHM</term>
|
||||
<listitem>
|
||||
<para>Available algorithms are <command>fsname</command>,
|
||||
<command>fsid</command> and <command>hostname</command>. The
|
||||
default value is <command>fsname</command>.
|
||||
<command>fsname_nodirs</command>, <command>fsid</command> and
|
||||
<command>hostname</command>. The default value is
|
||||
<command>fsname</command>.
|
||||
</para>
|
||||
<para>The <command>fsname</command> algorithm generates
|
||||
device id by hashing the kernel device name.
|
||||
</para>
|
||||
<para>The <command>fsname_nodirs</command> algorithm generates
|
||||
device id by hashing the kernel device name for files and by hashing
|
||||
the hostname for directories. This can be used to deliberately
|
||||
break lock coherency for directories in a cluster.
|
||||
</para>
|
||||
<para>The <command>fsid</command> algorithm generates
|
||||
the device id from the <command>f_fsid</command> returned
|
||||
from the <command>statfs()</command> syscall.
|
||||
|
@ -238,6 +238,18 @@ static uint64_t fileid_device_mapping_hostname(struct fileid_handle_data *data,
|
||||
return id;
|
||||
}
|
||||
|
||||
/* a device mapping using a fsname for files and hostname for dirs */
|
||||
static uint64_t fileid_device_mapping_fsname_nodirs(
|
||||
struct fileid_handle_data *data,
|
||||
const SMB_STRUCT_STAT *sbuf)
|
||||
{
|
||||
if (S_ISDIR(sbuf->st_ex_mode)) {
|
||||
return fileid_device_mapping_hostname(data, sbuf);
|
||||
}
|
||||
|
||||
return fileid_device_mapping_fsname(data, sbuf);
|
||||
}
|
||||
|
||||
/* device mapping functions using a fsid */
|
||||
static uint64_t fileid_device_mapping_fsid(struct fileid_handle_data *data,
|
||||
const SMB_STRUCT_STAT *sbuf)
|
||||
@ -302,6 +314,8 @@ static int fileid_connect(struct vfs_handle_struct *handle,
|
||||
algorithm);
|
||||
if (strcmp("fsname", algorithm) == 0) {
|
||||
data->device_mapping_fn = fileid_device_mapping_fsname;
|
||||
} else if (strcmp("fsname_nodirs", algorithm) == 0) {
|
||||
data->device_mapping_fn = fileid_device_mapping_fsname_nodirs;
|
||||
} else if (strcmp("fsid", algorithm) == 0) {
|
||||
data->device_mapping_fn = fileid_device_mapping_fsid;
|
||||
} else if (strcmp("hostname", algorithm) == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user