- Timestamp:
- May 20, 2009, 6:46:53 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/docs/htmldocs/Samba3-HOWTO/locking.html
r149 r204 1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 17. File and Record Locking</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.1"><link rel="start" href="index.html" title="The Official Samba 3.2.x HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="prev" href="AccessControls.html" title="Chapter 16. File, Directory, and Share Access Controls"><link rel="next" href="securing-samba.html" title="Chapter 18. Securing Samba"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 17. File and Record Locking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="AccessControls.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="securing-samba.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="locking"></a>Chapter 17. File and Record Locking</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jeremy</span> <span class="surname">Allison</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jra@samba.org">jra@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jelmer@samba.org">jelmer@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jht@samba.org">jht@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Eric</span> <span class="surname">Roseme</span></h3><div class="affiliation"><span class="orgname">HP Oplocks Usage Recommendations Whitepaper<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:eric.roseme@hp.com">eric.roseme@hp.com</a>></code></p></div></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="locking.html#id26085 79">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="locking.html#id2608676">Discussion</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2608934">Opportunistic Locking Overview</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2609919">Samba Oplocks Control</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2610013">Example Configuration</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2610427">MS Windows Oplocks and Caching Controls</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2610614">Workstation Service Entries</a></span></dt><dt><span class="sect2"><a href="locking.html#id2610636">Server Service Entries</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2610702">Persistent Data Corruption</a></span></dt><dt><span class="sect1"><a href="locking.html#id2610727">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2610795">locking.tdb Error Messages</a></span></dt><dt><span class="sect2"><a href="locking.html#id2610825">Problems Saving Files in MS Office on Windows XP</a></span></dt><dt><span class="sect2"><a href="locking.html#id2610850">Long Delays Deleting Files over Network with XP SP1</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2610881">Additional Reading</a></span></dt></dl></div><p>2 <a class="indexterm" name="id26085 68"></a>1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 17. File and Record Locking</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.1"><link rel="start" href="index.html" title="The Official Samba 3.2.x HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="prev" href="AccessControls.html" title="Chapter 16. File, Directory, and Share Access Controls"><link rel="next" href="securing-samba.html" title="Chapter 18. Securing Samba"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 17. File and Record Locking</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="AccessControls.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="securing-samba.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="locking"></a>Chapter 17. File and Record Locking</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jeremy</span> <span class="surname">Allison</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jra@samba.org">jra@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jelmer@samba.org">jelmer@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jht@samba.org">jht@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Eric</span> <span class="surname">Roseme</span></h3><div class="affiliation"><span class="orgname">HP Oplocks Usage Recommendations Whitepaper<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:eric.roseme@hp.com">eric.roseme@hp.com</a>></code></p></div></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="locking.html#id2608592">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="locking.html#id2608689">Discussion</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2608947">Opportunistic Locking Overview</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2609932">Samba Oplocks Control</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2610027">Example Configuration</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2610440">MS Windows Oplocks and Caching Controls</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2610627">Workstation Service Entries</a></span></dt><dt><span class="sect2"><a href="locking.html#id2610649">Server Service Entries</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2610715">Persistent Data Corruption</a></span></dt><dt><span class="sect1"><a href="locking.html#id2610741">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="locking.html#id2610808">locking.tdb Error Messages</a></span></dt><dt><span class="sect2"><a href="locking.html#id2610838">Problems Saving Files in MS Office on Windows XP</a></span></dt><dt><span class="sect2"><a href="locking.html#id2610863">Long Delays Deleting Files over Network with XP SP1</a></span></dt></dl></dd><dt><span class="sect1"><a href="locking.html#id2610895">Additional Reading</a></span></dt></dl></div><p> 2 <a class="indexterm" name="id2608582"></a> 3 3 One area that causes trouble for many network administrators is locking. 4 4 The extent of the problem is readily evident from searches over the Internet. 5 </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26085 79"></a>Features and Benefits</h2></div></div></div><p>6 <a class="indexterm" name="id2608 587"></a>5 </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2608592"></a>Features and Benefits</h2></div></div></div><p> 6 <a class="indexterm" name="id2608600"></a> 7 7 Samba provides all the same locking semantics that MS Windows clients expect 8 8 and that MS Windows NT4/200x servers also provide. 9 9 </p><p> 10 <a class="indexterm" name="id2608 599"></a>10 <a class="indexterm" name="id2608613"></a> 11 11 The term <span class="emphasis"><em>locking</em></span> has exceptionally broad meaning and covers 12 12 a range of functions that are all categorized under this one term. 13 13 </p><p> 14 <a class="indexterm" name="id26086 15"></a>15 <a class="indexterm" name="id26086 22"></a>16 <a class="indexterm" name="id26086 29"></a>14 <a class="indexterm" name="id2608628"></a> 15 <a class="indexterm" name="id2608635"></a> 16 <a class="indexterm" name="id2608642"></a> 17 17 Opportunistic locking is a desirable feature when it can enhance the 18 18 perceived performance of applications on a networked client. However, the … … 24 24 it is intended to provide. 25 25 </p><p> 26 <a class="indexterm" name="id26086 48"></a>26 <a class="indexterm" name="id2608661"></a> 27 27 The MS Windows network administrator needs to be aware that file and record 28 28 locking semantics (behavior) can be controlled either in Samba or by way of registry 29 29 settings on the MS Windows client. 30 30 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 31 <a class="indexterm" name="id26086 64"></a>31 <a class="indexterm" name="id2608677"></a> 32 32 Sometimes it is necessary to disable locking control settings on the Samba 33 33 server as well as on each MS Windows client! 34 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26086 76"></a>Discussion</h2></div></div></div><p>35 <a class="indexterm" name="id26086 84"></a>36 <a class="indexterm" name="id2608 690"></a>34 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2608689"></a>Discussion</h2></div></div></div><p> 35 <a class="indexterm" name="id2608697"></a> 36 <a class="indexterm" name="id2608704"></a> 37 37 There are two types of locking that need to be performed by an SMB server. 38 38 The first is <span class="emphasis"><em>record locking</em></span> that allows a client to lock … … 40 40 that are specified when a file is open. 41 41 </p><p> 42 <a class="indexterm" name="id2608711"></a>43 <a class="indexterm" name="id2608718"></a>44 42 <a class="indexterm" name="id2608725"></a> 45 43 <a class="indexterm" name="id2608732"></a> 46 <a class="indexterm" name="id2608739"></a> 44 <a class="indexterm" name="id2608738"></a> 45 <a class="indexterm" name="id2608745"></a> 46 <a class="indexterm" name="id2608752"></a> 47 47 Record locking semantics under UNIX are very different from record locking under 48 48 Windows. Versions of Samba before 2.2 have tried to use the native fcntl() UNIX … … 54 54 many more differences, too many to be listed here. 55 55 </p><p> 56 <a class="indexterm" name="id26087 59"></a>57 <a class="indexterm" name="id26087 66"></a>56 <a class="indexterm" name="id2608772"></a> 57 <a class="indexterm" name="id2608779"></a> 58 58 Samba 2.2 and above implement record locking completely independently of the 59 59 underlying UNIX system. If a byte-range lock that the client requests happens … … 61 61 No other locks can be seen by UNIX, anyway. 62 62 </p><p> 63 <a class="indexterm" name="id26087 81"></a>64 <a class="indexterm" name="id2608 788"></a>63 <a class="indexterm" name="id2608794"></a> 64 <a class="indexterm" name="id2608801"></a> 65 65 Strictly speaking, an SMB server should check for locks before every read and write call on 66 66 a file. Unfortunately, with the way fcntl() works, this can be slow and may overstress … … 71 71 will make lock checking calls on <span class="emphasis"><em>every</em></span> read and write call. 72 72 </p><p> 73 <a class="indexterm" name="id26088 30"></a>73 <a class="indexterm" name="id2608843"></a> 74 74 You can also disable byte-range locking completely by using 75 75 <a class="link" href="smb.conf.5.html#LOCKING">locking = no</a>. … … 78 78 tell clients that everything is okay. 79 79 </p><p> 80 <a class="indexterm" name="id2608857"></a>81 <a class="indexterm" name="id2608863"></a>82 80 <a class="indexterm" name="id2608870"></a> 83 <a class="indexterm" name="id260887 7"></a>84 <a class="indexterm" name="id260888 4"></a>81 <a class="indexterm" name="id2608876"></a> 82 <a class="indexterm" name="id2608883"></a> 85 83 <a class="indexterm" name="id2608890"></a> 86 84 <a class="indexterm" name="id2608897"></a> 85 <a class="indexterm" name="id2608904"></a> 86 <a class="indexterm" name="id2608910"></a> 87 87 The second class of locking is the <span class="emphasis"><em>deny modes</em></span>. These 88 88 are set by an application when it opens a file to determine what types of … … 91 91 <code class="constant">DENY_WRITE</code>, or <code class="constant">DENY_ALL</code>. There are also special compatibility 92 92 modes called <code class="constant">DENY_FCB</code> and <code class="constant">DENY_DOS</code>. 93 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id26089 34"></a>Opportunistic Locking Overview</h3></div></div></div><p>94 <a class="indexterm" name="id26089 42"></a>95 <a class="indexterm" name="id26089 49"></a>96 <a class="indexterm" name="id26089 56"></a>93 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2608947"></a>Opportunistic Locking Overview</h3></div></div></div><p> 94 <a class="indexterm" name="id2608955"></a> 95 <a class="indexterm" name="id2608962"></a> 96 <a class="indexterm" name="id2608969"></a> 97 97 Opportunistic locking (oplocks) is invoked by the Windows file system 98 98 (as opposed to an API) via registry entries (on the server and the client) … … 101 101 locally on the client that allows the following: 102 102 </p><div class="variablelist"><dl><dt><span class="term">Read-ahead:</span></dt><dd><p> 103 <a class="indexterm" name="id26089 79"></a>103 <a class="indexterm" name="id2608992"></a> 104 104 The client reads the local copy of the file, eliminating network latency. 105 105 </p></dd><dt><span class="term">Write caching:</span></dt><dd><p> 106 <a class="indexterm" name="id260 8998"></a>106 <a class="indexterm" name="id2609011"></a> 107 107 The client writes to the local copy of the file, eliminating network latency. 108 108 </p></dd><dt><span class="term">Lock caching:</span></dt><dd><p> 109 <a class="indexterm" name="id26090 16"></a>109 <a class="indexterm" name="id2609029"></a> 110 110 The client caches application locks locally, eliminating network latency. 111 111 </p></dd></dl></div><p> 112 <a class="indexterm" name="id26090 30"></a>113 <a class="indexterm" name="id26090 37"></a>114 <a class="indexterm" name="id26090 44"></a>112 <a class="indexterm" name="id2609043"></a> 113 <a class="indexterm" name="id2609050"></a> 114 <a class="indexterm" name="id2609057"></a> 115 115 The performance enhancement of oplocks is due to the opportunity of 116 116 exclusive access to the file even if it is opened with deny-none … … 118 118 other processes. 119 119 </p><div class="variablelist"><p class="title"><b>Windows Defines Four Kinds of Oplocks:</b></p><dl><dt><span class="term">Level1 Oplock</span></dt><dd><p> 120 <a class="indexterm" name="id2609075"></a>121 <a class="indexterm" name="id2609081"></a>122 120 <a class="indexterm" name="id2609088"></a> 123 <a class="indexterm" name="id2609095"></a> 121 <a class="indexterm" name="id2609094"></a> 122 <a class="indexterm" name="id2609101"></a> 123 <a class="indexterm" name="id2609108"></a> 124 124 The redirector sees that the file was opened with deny 125 125 none (allowing concurrent access), verifies that no … … 129 129 operations on the cached local file. 130 130 </p><p> 131 <a class="indexterm" name="id2609111"></a>132 <a class="indexterm" name="id2609118"></a>133 131 <a class="indexterm" name="id2609124"></a> 134 132 <a class="indexterm" name="id2609131"></a> 133 <a class="indexterm" name="id2609138"></a> 134 <a class="indexterm" name="id2609145"></a> 135 135 If a second process attempts to open the file, the open 136 136 is deferred while the redirector "breaks" the original … … 146 146 the oplock break. 147 147 </p></dd><dt><span class="term">Level2 Oplock</span></dt><dd><p> 148 <a class="indexterm" name="id26091 70"></a>149 <a class="indexterm" name="id26091 77"></a>150 <a class="indexterm" name="id26091 84"></a>148 <a class="indexterm" name="id2609183"></a> 149 <a class="indexterm" name="id2609190"></a> 150 <a class="indexterm" name="id2609197"></a> 151 151 Performs like a Level1 oplock, except caching is only 152 152 operative for reads. All other operations are performed 153 153 on the server disk copy of the file. 154 154 </p></dd><dt><span class="term">Filter Oplock</span></dt><dd><p> 155 <a class="indexterm" name="id26092 04"></a>155 <a class="indexterm" name="id2609218"></a> 156 156 Does not allow write or delete file access. 157 157 </p></dd><dt><span class="term">Batch Oplock</span></dt><dd><p> 158 <a class="indexterm" name="id26092 22"></a>158 <a class="indexterm" name="id2609236"></a> 159 159 Manipulates file openings and closings and allows caching 160 160 of file attributes. 161 161 </p></dd></dl></div><p> 162 <a class="indexterm" name="id26092 37"></a>162 <a class="indexterm" name="id2609250"></a> 163 163 An important detail is that oplocks are invoked by the file system, not 164 164 an application API. Therefore, an application can close an oplocked … … 167 167 preparation for the subsequent open by the second process. 168 168 </p><p> 169 <a class="indexterm" name="id26092 52"></a>170 <a class="indexterm" name="id26092 60"></a>171 <a class="indexterm" name="id26092 67"></a>172 <a class="indexterm" name="id26092 74"></a>169 <a class="indexterm" name="id2609266"></a> 170 <a class="indexterm" name="id2609273"></a> 171 <a class="indexterm" name="id2609280"></a> 172 <a class="indexterm" name="id2609287"></a> 173 173 <span class="emphasis"><em>Opportunistic locking</em></span> is actually an improper name for this feature. 174 174 The true benefit of this feature is client-side data caching, and … … 180 180 client-side caching benefit is negated. 181 181 </p><p> 182 <a class="indexterm" name="id2609 296"></a>182 <a class="indexterm" name="id2609309"></a> 183 183 The actual decision that a user or administrator should consider is 184 184 whether it is sensible to share among multiple users data that will … … 190 190 unreliable, or counterproductive. 191 191 </p><p> 192 <a class="indexterm" name="id26093 21"></a>192 <a class="indexterm" name="id2609334"></a> 193 193 Oplocks is by default set to “<span class="quote">on</span>” by Samba on all 194 194 configured shares, so careful attention should be given to each case to … … 197 197 where oplocks may be effectively configured. 198 198 </p><p> 199 <a class="indexterm" name="id26093 39"></a>200 <a class="indexterm" name="id26093 46"></a>199 <a class="indexterm" name="id2609352"></a> 200 <a class="indexterm" name="id2609359"></a> 201 201 Windows oplocks is a lightweight performance-enhancing 202 202 feature. It is not a robust and reliable protocol. Every … … 209 209 storm. This configuration will likely encounter problems with oplocks. 210 210 </p><p> 211 <a class="indexterm" name="id26093 66"></a>211 <a class="indexterm" name="id2609379"></a> 212 212 Oplocks can be beneficial to perceived client performance when treated 213 213 as a configuration toggle for client-side data caching. If the data … … 223 223 continuous data availability. 224 224 </p><p> 225 <a class="indexterm" name="id2609 388"></a>226 <a class="indexterm" name="id2609 395"></a>225 <a class="indexterm" name="id2609401"></a> 226 <a class="indexterm" name="id2609408"></a> 227 227 Windows client failover behavior is more at risk of application 228 228 interruption than other platforms because it is dependent upon an … … 234 234 require restarting. 235 235 </p><p> 236 <a class="indexterm" name="id26094 22"></a>237 <a class="indexterm" name="id26094 29"></a>238 <a class="indexterm" name="id26094 35"></a>236 <a class="indexterm" name="id2609436"></a> 237 <a class="indexterm" name="id2609442"></a> 238 <a class="indexterm" name="id2609449"></a> 239 239 If a client session has been caching writes and reads locally due to 240 240 oplocks, it is likely that the data will be lost when the … … 251 251 testing should be done with all affected applications with oplocks 252 252 enabled and disabled. 253 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26094 60"></a>Exclusively Accessed Shares</h4></div></div></div><p>253 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609473"></a>Exclusively Accessed Shares</h4></div></div></div><p> 254 254 Oplocks is most effective when it is confined to shares 255 255 that are exclusively accessed by a single user, or by only one user at … … 260 260 Home directories are the most obvious examples of where the performance 261 261 benefit of oplocks can be safely realized. 262 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26094 80"></a>Multiple-Accessed Shares or Files</h4></div></div></div><p>262 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609493"></a>Multiple-Accessed Shares or Files</h4></div></div></div><p> 263 263 As each additional user accesses a file in a share with oplocks 264 264 enabled, the potential for delays and resulting perceived poor … … 272 272 the potential performance improvement is negated and eventually results 273 273 in a performance bottleneck. 274 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26095 04"></a>UNIX or NFS Client-Accessed Files</h4></div></div></div><p>275 <a class="indexterm" name="id26095 12"></a>276 <a class="indexterm" name="id26095 19"></a>274 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609517"></a>UNIX or NFS Client-Accessed Files</h4></div></div></div><p> 275 <a class="indexterm" name="id2609525"></a> 276 <a class="indexterm" name="id2609532"></a> 277 277 Local UNIX and NFS clients access files without a mandatory 278 278 file-locking mechanism. Thus, these client platforms are incapable of … … 284 284 If files are shared between Windows clients and either local UNIX 285 285 or NFS users, turn oplocks off. 286 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609540"></a>Slow and/or Unreliable Networks</h4></div></div></div><p> 287 <a class="indexterm" name="id2609548"></a> 288 <a class="indexterm" name="id2609555"></a> 286 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609553"></a>Slow and/or Unreliable Networks</h4></div></div></div><p> 289 287 <a class="indexterm" name="id2609561"></a> 288 <a class="indexterm" name="id2609568"></a> 289 <a class="indexterm" name="id2609574"></a> 290 290 The biggest potential performance improvement for oplocks 291 291 occurs when the client-side caching of reads and writes delivers the … … 302 302 oplocks if there is any chance of multiple users 303 303 regularly opening the same file. 304 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609 587"></a>Multiuser Databases</h4></div></div></div><p>305 <a class="indexterm" name="id2609 595"></a>306 <a class="indexterm" name="id26096 02"></a>307 <a class="indexterm" name="id26096 09"></a>304 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609600"></a>Multiuser Databases</h4></div></div></div><p> 305 <a class="indexterm" name="id2609608"></a> 306 <a class="indexterm" name="id2609615"></a> 307 <a class="indexterm" name="id2609622"></a> 308 308 Multiuser databases clearly pose a risk due to their very nature they are typically heavily 309 309 accessed by numerous users at random intervals. Placing a multiuser database on a share with oplocks enabled 310 310 will likely result in a locking management bottleneck on the Samba server. Whether the database application is 311 311 developed in-house or a commercially available product, ensure that the share has oplocks disabled. 312 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609628"></a>PDM Data Shares</h4></div></div></div><p> 313 <a class="indexterm" name="id2609636"></a> 314 <a class="indexterm" name="id2609642"></a> 312 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609642"></a>PDM Data Shares</h4></div></div></div><p> 315 313 <a class="indexterm" name="id2609649"></a> 316 <a class="indexterm" name="id2609656"></a> 317 <a class="indexterm" name="id2609663"></a> 314 <a class="indexterm" name="id2609655"></a> 315 <a class="indexterm" name="id2609662"></a> 316 <a class="indexterm" name="id2609669"></a> 317 <a class="indexterm" name="id2609676"></a> 318 318 Process data management (PDM) applications such as IMAN, Enovia, and Clearcase are increasing in usage with 319 319 Windows client platforms and therefore with SMB datastores. PDM applications manage multiuser environments for … … 323 323 application and PDM server to negotiate and maintain. It is appropriate to eliminate the client OS from any 324 324 caching tasks, and the server from any oplocks management, by disabling oplocks on the share. 325 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26096 85"></a>Beware of Force User</h4></div></div></div><p>326 <a class="indexterm" name="id2609 693"></a>325 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609698"></a>Beware of Force User</h4></div></div></div><p> 326 <a class="indexterm" name="id2609706"></a> 327 327 Samba includes an <code class="filename">smb.conf</code> parameter called <a class="link" href="smb.conf.5.html#FORCEUSER">force user</a> that changes the user 328 328 accessing a share from the incoming user to whatever user is defined by the <code class="filename">smb.conf</code> variable. If oplocks is … … 339 339 </p></li><li><p> 340 340 Oplocks enabled. 341 </p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26097 73"></a>Advanced Samba Oplocks Parameters</h4></div></div></div><p>342 <a class="indexterm" name="id26097 81"></a>343 <a class="indexterm" name="id2609 788"></a>344 <a class="indexterm" name="id2609 795"></a>341 </p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609786"></a>Advanced Samba Oplocks Parameters</h4></div></div></div><p> 342 <a class="indexterm" name="id2609794"></a> 343 <a class="indexterm" name="id2609801"></a> 344 <a class="indexterm" name="id2609808"></a> 345 345 Samba provides oplock parameters that allow the 346 346 administrator to adjust various properties of the oplock mechanism to … … 351 351 <a class="link" href="smb.conf.5.html#OPLOCKCONTENTIONLIMIT">oplock contention limit</a>. 352 352 </p><p> 353 <a class="indexterm" name="id26098 35"></a>353 <a class="indexterm" name="id2609848"></a> 354 354 For most users, administrators, and environments, if these parameters 355 355 are required, then the better option is simply to turn oplocks off. … … 357 357 this parameter unless you have read and understood the Samba oplock code.</span>” 358 358 This is good advice. 359 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26098 52"></a>Mission-Critical, High-Availability</h4></div></div></div><p>359 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2609865"></a>Mission-Critical, High-Availability</h4></div></div></div><p> 360 360 In mission-critical, high-availability environments, data integrity is 361 361 often a priority. Complex and expensive configurations are implemented … … 387 387 testing should be done with all affected applications with oplocks 388 388 enabled and disabled. 389 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26099 19"></a>Samba Oplocks Control</h2></div></div></div><p>389 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2609932"></a>Samba Oplocks Control</h2></div></div></div><p> 390 390 Oplocks is a unique Windows file locking feature. It is 391 391 not really file locking, but is included in most discussions of Windows … … 437 437 Another factor to consider is the perceived performance of file access. If oplocks provide no 438 438 measurable speed benefit on your network, it might not be worth the hassle of dealing with them. 439 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id26100 13"></a>Example Configuration</h3></div></div></div><p>439 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610027"></a>Example Configuration</h3></div></div></div><p> 440 440 In the following section we examine two distinct aspects of Samba locking controls. 441 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26100 24"></a>Disabling Oplocks</h4></div></div></div><p>441 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2610037"></a>Disabling Oplocks</h4></div></div></div><p> 442 442 You can disable oplocks on a per-share basis with the following: 443 443 </p><p> 444 </p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[acctdata]</code></em></td></tr><tr><td><a class="indexterm" name="id26100 51"></a><em class="parameter"><code>oplocks = False</code></em></td></tr><tr><td><a class="indexterm" name="id2610062"></a><em class="parameter"><code>level2 oplocks = False</code></em></td></tr></table><p>444 </p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[acctdata]</code></em></td></tr><tr><td><a class="indexterm" name="id2610064"></a><em class="parameter"><code>oplocks = False</code></em></td></tr><tr><td><a class="indexterm" name="id2610076"></a><em class="parameter"><code>level2 oplocks = False</code></em></td></tr></table><p> 445 445 </p><p> 446 446 The default oplock type is Level1. Level2 oplocks are enabled on a per-share basis … … 449 449 Alternately, you could disable oplocks on a per-file basis within the share: 450 450 </p><p> 451 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2610 098"></a><em class="parameter"><code>veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/</code></em></td></tr></table><p>451 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2610112"></a><em class="parameter"><code>veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/</code></em></td></tr></table><p> 452 452 </p><p> 453 453 If you are experiencing problems with oplocks, as apparent from Samba's log entries, 454 454 you may want to play it safe and disable oplocks and Level2 oplocks. 455 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id26101 19"></a>Disabling Kernel Oplocks</h4></div></div></div><p>455 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2610132"></a>Disabling Kernel Oplocks</h4></div></div></div><p> 456 456 Kernel oplocks is an <code class="filename">smb.conf</code> parameter that notifies Samba (if 457 457 the UNIX kernel has the capability to send a Windows client an oplock … … 466 466 basis in the <code class="filename">smb.conf</code> file. 467 467 </p><p> 468 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id26101 59"></a><em class="parameter"><code>kernel oplocks = yes</code></em></td></tr></table><p>468 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2610172"></a><em class="parameter"><code>kernel oplocks = yes</code></em></td></tr></table><p> 469 469 The default is no. 470 470 </p><p> … … 481 481 <code class="filename">smb.conf</code> file as shown in <a class="link" href="locking.html#far1" title="Example 17.1. Share with Some Files Oplocked">“Share with Some Files Oplocked”</a>. 482 482 </p><p> 483 </p><div class="example"><a name="far1"></a><p class="title"><b>Example 17.1. Share with Some Files Oplocked</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id26102 35"></a><em class="parameter"><code>veto oplock files = /filename.htm/*.txt/</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[share_name]</code></em></td></tr><tr><td><a class="indexterm" name="id2610256"></a><em class="parameter"><code>veto oplock files = /*.exe/filename.ext/</code></em></td></tr></table></div></div><p><br class="example-break">483 </p><div class="example"><a name="far1"></a><p class="title"><b>Example 17.1. Share with Some Files Oplocked</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2610248"></a><em class="parameter"><code>veto oplock files = /filename.htm/*.txt/</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[share_name]</code></em></td></tr><tr><td><a class="indexterm" name="id2610270"></a><em class="parameter"><code>veto oplock files = /*.exe/filename.ext/</code></em></td></tr></table></div></div><p><br class="example-break"> 484 484 </p><p> 485 485 <a class="link" href="smb.conf.5.html#OPLOCKBREAKWAITTIME">oplock break wait time</a> is an <code class="filename">smb.conf</code> parameter … … 488 488 Oplock break wait time can only be configured globally in the <code class="filename">smb.conf</code> file as shown: 489 489 </p><p> 490 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id26103 14"></a><em class="parameter"><code>oplock break wait time = 0 (default)</code></em></td></tr></table><p>490 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2610327"></a><em class="parameter"><code>oplock break wait time = 0 (default)</code></em></td></tr></table><p> 491 491 </p><p> 492 492 <span class="emphasis"><em>Oplock break contention limit</em></span> is an <code class="filename">smb.conf</code> parameter that limits the … … 497 497 the entire server, in the <code class="filename">smb.conf</code> file as shown in <a class="link" href="locking.html#far3" title="Example 17.2. Configuration with Oplock Break Contention Limit">“Configuration with Oplock Break Contention Limit”</a>. 498 498 </p><p> 499 </p><div class="example"><a name="far3"></a><p class="title"><b>Example 17.2. Configuration with Oplock Break Contention Limit</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2610 388"></a><em class="parameter"><code>oplock break contention limit = 2 (default)</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[share_name]</code></em></td></tr><tr><td><a class="indexterm" name="id2610409"></a><em class="parameter"><code>oplock break contention limit = 2 (default)</code></em></td></tr></table></div></div><p><br class="example-break">500 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26104 27"></a>MS Windows Oplocks and Caching Controls</h2></div></div></div><p>499 </p><div class="example"><a name="far3"></a><p class="title"><b>Example 17.2. Configuration with Oplock Break Contention Limit</b></p><div class="example-contents"><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2610401"></a><em class="parameter"><code>oplock break contention limit = 2 (default)</code></em></td></tr><tr><td> </td></tr><tr><td><em class="parameter"><code>[share_name]</code></em></td></tr><tr><td><a class="indexterm" name="id2610422"></a><em class="parameter"><code>oplock break contention limit = 2 (default)</code></em></td></tr></table></div></div><p><br class="example-break"> 500 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2610440"></a>MS Windows Oplocks and Caching Controls</h2></div></div></div><p> 501 501 There is a known issue when running applications (like Norton Antivirus) on a Windows 2000/ XP 502 502 workstation computer that can affect any application attempting to access shared database files … … 513 513 have oplocks disabled in order to minimize the risk of data file corruption. 514 514 This includes Windows 9x/Me, Windows NT, Windows 200x, and Windows XP. 515 <sup>[<a name="id26104 59" href="#ftn.id2610459" class="footnote">5</a>]</sup>515 <sup>[<a name="id2610472" href="#ftn.id2610472" class="footnote">5</a>]</sup> 516 516 </p><p> 517 517 If you are using a Windows NT family workstation in place of a server, you must also … … 591 591 writes or locks at this point, they need not respond to the break-to-none advisory; 592 592 all they need do is invalidate locally cashed read-ahead data. 593 </p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id26106 14"></a>Workstation Service Entries</h3></div></div></div><pre class="programlisting">593 </p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610627"></a>Workstation Service Entries</h3></div></div></div><pre class="programlisting"> 594 594 \HKEY_LOCAL_MACHINE\System\ 595 595 CurrentControlSet\Services\LanmanWorkstation\Parameters … … 600 600 This indicates whether the redirector should use oplocks performance 601 601 enhancement. This parameter should be disabled only to isolate problems. 602 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id26106 36"></a>Server Service Entries</h3></div></div></div><pre class="programlisting">602 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610649"></a>Server Service Entries</h3></div></div></div><pre class="programlisting"> 603 603 \HKEY_LOCAL_MACHINE\System\ 604 604 CurrentControlSet\Services\LanmanServer\Parameters … … 629 629 request. Smaller values can allow detection of crashed clients more quickly but can 630 630 potentially cause loss of cached data. 631 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26107 02"></a>Persistent Data Corruption</h2></div></div></div><p>631 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2610715"></a>Persistent Data Corruption</h2></div></div></div><p> 632 632 If you have applied all of the settings discussed in this chapter but data corruption problems 633 633 and other symptoms persist, here are some additional things to check out. … … 640 640 to the new one. There are several known methods for doing this that can be found in 641 641 our knowledge base. 642 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26107 27"></a>Common Errors</h2></div></div></div><p>642 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2610741"></a>Common Errors</h2></div></div></div><p> 643 643 In some sites locking problems surface as soon as a server is installed; in other sites 644 644 locking problems may not surface for a long time. Almost without exception, when a locking … … 670 670 Make sure that you give as much information as you possibly can to help isolate the 671 671 cause and to allow replication of the problem (an essential step in problem isolation and correction). 672 </p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610 795"></a>locking.tdb Error Messages</h3></div></div></div><p>672 </p></li></ul></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610808"></a>locking.tdb Error Messages</h3></div></div></div><p> 673 673 “<span class="quote"> 674 674 We are seeing lots of errors in the Samba logs, like: … … 684 684 </p><p> 685 685 This error indicates a corrupted tdb. Stop all instances of smbd, delete locking.tdb, and restart smbd. 686 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id26108 25"></a>Problems Saving Files in MS Office on Windows XP</h3></div></div></div><a class="indexterm" name="id2610832"></a><p>This is a bug in Windows XP. More information can be686 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610838"></a>Problems Saving Files in MS Office on Windows XP</h3></div></div></div><a class="indexterm" name="id2610845"></a><p>This is a bug in Windows XP. More information can be 687 687 found in <a class="ulink" href="http://support.microsoft.com/?id=812937" target="_top">Microsoft Knowledge Base article 812937</a></p>. 688 688 689 </div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id26108 50"></a>Long Delays Deleting Files over Network with XP SP1</h3></div></div></div><p>“<span class="quote">It sometimes takes approximately 35 seconds to delete files over the network after XP SP1 has been applied.</span>”</p><a class="indexterm" name="id2610862"></a><p>This is a bug in Windows XP. More information can be found in <a class="ulink" href="http://support.microsoft.com/?id=811492" target="_top">689 </div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610863"></a>Long Delays Deleting Files over Network with XP SP1</h3></div></div></div><p>“<span class="quote">It sometimes takes approximately 35 seconds to delete files over the network after XP SP1 has been applied.</span>”</p><a class="indexterm" name="id2610875"></a><p>This is a bug in Windows XP. More information can be found in <a class="ulink" href="http://support.microsoft.com/?id=811492" target="_top"> 690 690 Microsoft Knowledge Base article 811492</a></p>. 691 </div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id26108 81"></a>Additional Reading</h2></div></div></div><p>691 </div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2610895"></a>Additional Reading</h2></div></div></div><p> 692 692 You may want to check for an updated documentation regarding file and record locking issues on the Microsoft 693 693 <a class="ulink" href="http://support.microsoft.com/" target="_top">Support</a> web site. Additionally, search for the word … … 696 696 Section of the Microsoft MSDN Library on opportunistic locking: 697 697 </p><p> 698 <a class="indexterm" name="id26109 18"></a>698 <a class="indexterm" name="id2610932"></a> 699 699 Microsoft Knowledge Base, “<span class="quote">Maintaining Transactional Integrity with OPLOCKS</span>”, 700 700 Microsoft Corporation, April 1999, <a class="ulink" href="http://support.microsoft.com/?id=224992" target="_top">Microsoft 701 701 KB Article 224992</a>. 702 702 </p><p> 703 <a class="indexterm" name="id26109 42"></a>703 <a class="indexterm" name="id2610956"></a> 704 704 Microsoft Knowledge Base, “<span class="quote">Configuring Opportunistic Locking in Windows 2000</span>”, 705 705 Microsoft Corporation, April 2001 <a class="ulink" href="http://support.microsoft.com/?id=296264" target="_top">Microsoft KB Article 296264</a>. 706 706 </p><p> 707 <a class="indexterm" name="id26109 66"></a>707 <a class="indexterm" name="id2610980"></a> 708 708 Microsoft Knowledge Base, “<span class="quote">PC Ext: Explanation of Opportunistic Locking on Windows NT</span>”, 709 709 Microsoft Corporation, April 1995 <a class="ulink" href="http://support.microsoft.com/?id=129202" target="_top">Microsoft 710 710 KB Article 129202</a>. 711 </p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id26104 59" href="#id2610459" class="para">5</a>] </sup>Microsoft has documented this in Knowledge Base article 300216.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="AccessControls.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="securing-samba.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 16. File, Directory, and Share Access Controls </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 18. Securing Samba</td></tr></table></div></body></html>711 </p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id2610472" href="#id2610472" class="para">5</a>] </sup>Microsoft has documented this in Knowledge Base article 300216.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="AccessControls.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="securing-samba.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 16. File, Directory, and Share Access Controls </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 18. Securing Samba</td></tr></table></div></body></html>
Note:
See TracChangeset
for help on using the changeset viewer.