1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="vfs_fileid.8">
6 <refentrytitle>vfs_fileid</refentrytitle>
7 <manvolnum>8</manvolnum>
8 <refmiscinfo class="source">Samba</refmiscinfo>
9 <refmiscinfo class="manual">System Administration tools</refmiscinfo>
10 <refmiscinfo class="version">&doc.version;</refmiscinfo>
15 <refname>vfs_fileid</refname>
16 <refpurpose>Generates file_id structs with unique device id values for
17 cluster setups. It also adds ways to deliberately break lock coherency for specific inodes</refpurpose>
22 <command>vfs objects = fileid</command>
27 <title>DESCRIPTION</title>
29 <para>This VFS module is part of the
30 <citerefentry><refentrytitle>samba</refentrytitle>
31 <manvolnum>7</manvolnum></citerefentry>
34 <para>Samba uses file_id structs to uniquely identify files
35 for locking purpose. By default the file_id contains the device
36 and inode number returned by the <command>stat()</command> system call.
37 As the file_id is a unique identifier of a file, it must be the same
38 on all nodes in a cluster setup. This module overloads the
39 <command>SMB_VFS_FILE_ID_CREATE()</command> operation and
40 generates the device number based on the configured algorithm
41 (see the "fileid:algorithm" option).
44 <para>When using the fsname or fsid algorithm a
45 <command>stat()</command> and <command>statfs()</command> call is
46 required for all mounted file systems to generate the file_id. If e.g.
47 an NFS file system is unresponsive such a call might block and the smbd
48 process will become unresponsive. Use the "fileid:fstype deny",
49 "fileid:fstype allow", "fileid:mntdir deny", or "fileid:mntdir allow"
50 options to ignore potentially unresponsive file systems.
56 <title>OPTIONS</title>
61 <term>fileid:algorithm = ALGORITHM</term>
63 <para>Available algorithms are <command>fsname</command>,
64 <command>fsid</command>, <command>next_module</command>. The default value is
65 <command>fsname</command>. As well as the following legacy
66 algorithms: <command>fsname_nodirs</command>, <command>fsname_norootdir</command>,
67 <command>fsname_norootdir_ext</command> and <command>hostname</command>.
70 <para>The <command>fsname</command> algorithm generates
71 device id by hashing the kernel device name.
74 <para>The <command>fsid</command> algorithm generates
75 the device id from the <command>f_fsid</command> returned
76 from the <command>statfs()</command> syscall.
79 <para>The <command>next_module</command> algorithm lets the next vfs module
80 in the module chain generate the id. This is mainly used in combination
81 with the various 'nolock' features the fileid module provides.
84 <para>The legacy <command>hostname</command> algorithm generates unique
85 devid by hashing the hostname and low level device id.
86 It also implies <command>fileid:nolock_all_inodes=yes</command>.
87 This can be used to deliberately break lock coherency in a cluster
88 and with <command>fileid:nolock_max_slots</command> also between local processes
89 within a node. NOTE: Do not use this without knowing what you are doing!
90 It breaks SMB semantics and it can lead to data corruption!
91 This implies <command>fileid:nolock_all_inodes=yes</command>.
94 <para>The legacy <command>fsname_nodirs</command> algorithm is an alias
95 for using the <command>fsname</command> algorithm together with
96 <command>fileid:nolock_all_dirs=yes</command>.
97 NOTE: Do not use this without knowing what you are doing!
98 It breaks SMB semantics!
99 See <command>fileid:nolock_paths</command> for a more fine grained
103 <para>The legacy <command>fsname_norootdir</command> algorithm is an alias
104 for using the <command>fsname</command> algorithm together with
105 <command>fileid:nolock_paths= <quote>.</quote> </command>. It means
106 this can be used to deliberately break lock coherency
107 in a cluster for the root directory of a share.
110 <para>The legacy <command>fsname_norootdir_ext</command> algorithm is an alias
111 for using the <command>fsname</command> algorithm together with
112 <command>fileid:nolock_paths= <quote>.</quote></command> and
113 <command>fileid:nolock_max_slots = 18446744073709551615</command>.
114 It means this can be used to deliberately break lock coherency
115 completely for the root directory of a share. Even local processes
116 are no longer lock coherent.
123 <term>fileid:mapping = ALGORITHM</term>
125 <para>This option is the legacy version of the
126 <command>fileid:algorithm</command> option, which was used in earlier
127 versions of fileid mapping feature in custom Samba 3.0 versions.
133 <term>fileid:fstype deny = LIST</term>
135 <para>List of file system types to be ignored for file_id
142 <term>fileid:fstype allow = LIST</term>
144 <para>List of file system types to be allowed for file_id
145 generation. If this option is set, file system types not listed
152 <term>fileid:mntdir deny = LIST</term>
154 <para>List of file system mount points to be ignored for
161 <term>fileid:mntdir allow = LIST</term>
163 <para>List of file system mount points to be allowed for file_id
164 generation. If this option is set, file system mount points
165 not listed here are ignored.
171 <term>fileid:nolock_max_slots = NUMBER(1-18446744073709551615)</term>
173 <para>This option alters the behavior of the <command>nolock</command> algorithm
174 in a way that it also breaks the lock coherency between individual processes
175 on the same host. The default is to have just 1 concurrent slot available per host.
176 By increasing the number of slots you can specify how many concurrent processes
177 can work on a given inode without contention, the number should typically be larger
178 than the number of logical cpus, maybe 2 times num_cpus.
184 <term>fileid:nolock_all_dirs = BOOL</term>
186 <para>This option triggers the use of the fileid nolock behavior
187 for all directory inodes, which can be used to deliberately break
188 the lock coherency for all directories.
189 NOTE: Do not use this without knowing what you are doing!
190 It breaks SMB semantics!
191 See <command>fileid:nolock_paths</command> for a more fine grained
198 <term>fileid:nolock_all_inodes = BOOL</term>
200 <para>This option triggers the use of the fileid nolock algorithm
201 for all directoriy inode, which can be used to deliberately break
202 the lock coherency for all directories.
203 NOTE: Do not use this without knowing what you are doing!
204 It breaks SMB semantics and it can lead to data corruption!
205 See <command>fileid:nolock_paths</command> for a more fine grained
212 <term>fileid:nolock_paths = LIST</term>
214 <para>This option specifies a path list referring to files and/or directories,
215 which should use fileid nolock algorithm in order to deliberately break
216 the lock coherency for them. The specified paths can be relative to
217 the share root directory or absolute. The names are case sensitive unix pathnames!
218 Note all paths are only evaluated at tree connect time, when the share is being connected, from there on
219 only the related device and inode numbers from the stat() syscall are compared.
220 Non existing paths will generate a log level 0 message.
221 NOTE: This option should be used with care as it breaks SMB semantics!
222 But it may help in situation where a specific (commonly read-only) inode is highly contended.
228 <term>fileid:nolockinode = NUMBER</term>
230 <para>This legacy option triggers use of the fileid nolock behavior
231 for the configured inode, while ignoring and device id. This can be used to deliberately break
232 lock coherency for the corresponding file or directory in a
233 cluster. Using the <command>fileid:nolock_paths</command> option is much more flexible and simpler to use.
241 <title>EXAMPLES</title>
243 <para>Usage of the <command>fileid</command> module with the
244 <command>fsid</command> algorithm:</para>
247 <smbconfsection name="[global]"/>
248 <smbconfoption name="vfs objects">fileid</smbconfoption>
249 <smbconfoption name="fileid:algorithm">fsid</smbconfoption>
252 <para>Usage of the <command>fileid</command> module in order
253 avoid load on heavily contended (most likely read-only) inodes.</para>
256 <smbconfsection name="[global]"/>
257 <smbconfoption name="vfs objects">fileid</smbconfoption>
258 <smbconfoption name="fileid:algorithm">next_module</smbconfoption>
259 <smbconfoption name="fileid:nolock_paths">. ContendedFolder1 /path/to/contended.exe</smbconfoption>
260 <smbconfoption name="fileid:nolock_max_slots">256</smbconfoption>
266 <title>VERSION</title>
268 <para>This man page is part of version &doc.version; of the Samba suite.
273 <title>AUTHOR</title>
275 <para>The original Samba software and related utilities
276 were created by Andrew Tridgell. Samba is now developed
277 by the Samba Team as an Open Source project similar
278 to the way the Linux kernel is developed.</para>