<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.
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)
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) {