Solomon Boulos has uploaded this change for review. (
https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/487471 )
Change subject: Implement basic NLM locking methods.
......................................................................
Implement basic NLM locking methods.
Ganesha routes all NLM methods through the single lock_op2 handler, so I wired
that up and did a "No, I can't handle async calls" implementation. This is
good
enough for a basic NLM LOCK as well as UNLOCK, but I don't think there's a great
way for me to test the NLM_TEST op from the command line (without running either
cthon or writing some basic fcntl code).
Basic locking in action:
# Terminal 1: Open a lockfile.
$ flock proxy-mount/lockfile -c cat
(Generates lockd: LOCK called on the backend server)
# Terminal 2: See that Terminal 1's flock has the lockfile open.
$ lsof proxy-mount/lockfile
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
flock 2149 boulos 3rW REG 0,38 0 541739 proxy-mount/lockfile
cat 2151 boulos 3r REG 0,38 0 541739 proxy-mount/lockfile
# Terminal 2: Try to grab the lockfile while it's held.
$ flock -w 1 proxy-mount/lockfile -c echo ; echo $?
1
(Failed to acquire the lock within 1 second)
# Terminal 1: Kill flock.
$ Ctrl-C
(Generates lockd: UNLOCK called on the backend server)
I haven't written up / thought deeply yet about how reclaim and lock recovery
are supposed to work. From a NFSv3 backend's (NFSD) perspective, the Ganesha
proxy is its only "client". If the backend crashes, it will try to inform
Ganesha, who will be fairly confused (Ganesha doesn't "know" that it's
an NFS
Client). If a client crashes, it will inform Ganesha's NFSD that it has crashed
and try to reclaim. In theory, Ganesha's NFSD it totally prepared for that,
because the state_lock code keeps track of the owners while the locks are held
(they just happen to be held on the non-Ganesha backend too). Here's hoping.
Change-Id: I0217e046ab694da67ee8b2a3115b7f79616817f5
Signed-off-by: Solomon Boulos <boulos(a)google.com>
---
M src/FSAL/FSAL_PROXY_V3/CMakeLists.txt
M src/FSAL/FSAL_PROXY_V3/main.c
A src/FSAL/FSAL_PROXY_V3/nlm.c
M src/FSAL/FSAL_PROXY_V3/proxyv3_fsal_methods.h
M src/FSAL/FSAL_PROXY_V3/utils.c
5 files changed, 461 insertions(+), 13 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/71/487471/1
--
To view, visit
https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/487471
To unsubscribe, or for help writing mail filters, visit
https://review.gerrithub.io/settings
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I0217e046ab694da67ee8b2a3115b7f79616817f5
Gerrit-Change-Number: 487471
Gerrit-PatchSet: 1
Gerrit-Owner: Solomon Boulos <boulos(a)google.com>
Gerrit-MessageType: newchange