]> git.ipfire.org Git - people/ms/linux.git/commit - fs/nfs/client.c
nfs: introduce mount option '-olocal_lock' to make locks local
authorSuresh Jayaraman <sjayaraman@suse.de>
Thu, 23 Sep 2010 12:55:58 +0000 (08:55 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 23 Sep 2010 12:55:58 +0000 (08:55 -0400)
commit5eebde23223aeb0ad2d9e3be6590ff8bbfab0fc2
tree7cfabe0191855550292b0a0c9b317315dffb2a50
parent63185942c5f138c62de16b4cbc7eee494a58fea8
nfs: introduce mount option '-olocal_lock' to make locks local

NFS clients since 2.6.12 support flock locks by emulating fcntl byte-range
locks. Due to this, some windows applications which seem to use both flock
(share mode lock mapped as flock by Samba) and fcntl locks sequentially on
the same file, can't lock as they falsely assume the file is already locked.
The problem was reported on a setup with windows clients accessing excel files
on a Samba exported share which is originally a NFS mount from a NetApp filer.

Older NFS clients (< 2.6.12) did not see this problem as flock locks were
considered local. To support legacy flock behavior, this patch adds a mount
option "-olocal_lock=" which can take the following values:

   'none'   - Neither flock locks nor POSIX locks are local
   'flock'  - flock locks are local
   'posix'  - fcntl/POSIX locks are local
   'all' - Both flock locks and POSIX locks are local

Testing:

   - This patch was tested by using -olocal_lock option with different values
     and the NLM calls were noted from the network packet captured.

     'none'  - NLM calls were seen during both flock() and fcntl(), flock lock
           was granted, fcntl was denied
     'flock' - no NLM calls for flock(), NLM call was seen for fcntl(),
           granted
     'posix' - NLM call was seen for flock() - granted, no NLM call for fcntl()
     'all'   - no NLM calls were seen during both flock() and fcntl()

   - No bugs were seen during NFSv4 locking/unlocking in general and NFSv4
     reboot recovery.

Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/client.c
fs/nfs/file.c
fs/nfs/super.c
include/linux/nfs_mount.h