NFS Locking Issues

Introduction

I've run into a lot of different issues with NFS and locking. It's sometimes confusing which locking mechanism an application uses. I'm going to try to keep track of them here as I learn about them.

NFS Locking Methods

Unix lock calls and locking methods are discussed in other places. Briefly I'm concerned with the lockf, flock, and fcntl calls. There are some applications that will utilize their own locking methodologies, for example Samba. The locking methods are shown for certain applications in Table 1, “Applications And Their Locking Methods”.

Table 1. Applications And Their Locking Methods

ApplicationLock MethodDescription
procmaildot lock, fcntl, lockfThis mail delivery agent will try to get multiple locks in case another agent, e.g. dovecot, tries to lock the file using another method.
SambainternalUses it's own locking method as the byte range of fcntl is too small.