HOWTO Activate kernel oplocks in Samba on Debian GNU/Linux (up to Sarge)

This article was first written in February 2006 for the BeezNest technical
website (http://glasnost.beeznest.org/articles/327).
Starting from kernel 2.4, Linux has got the kernel oplocks feature. Kernel oplocks would permit Samba to share locks with the UNIX filesystem, to allow local Linux applications or applications accessing the files through NFS for example to be notified of files already opened for writing by a client using SMB. Sadly, the Samba package in Debian GNU/Linux up to Sarge disable this feature to keep compatibility with kernels strictly inferior to 2.4. To activate it, you then have to rebuild the package, after commenting the lines disabling this feature in the file debian/config.cache of the package sources. Those following lines are the ones to comment:
samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=${samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=no}
samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=${samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=no}
samba_cv_HAVE_KERNEL_SHARE_MODES=${samba_cv_HAVE_KERNEL_SHARE_MODES=no}
Commenting the next lines would probably allow you to enable even more features.