• Wendy Cheng's avatar
    lockd: unlock lockd locks associated with a given server ip · 4373ea84
    Wendy Cheng authored
    For high-availability NFS service, we generally need to be able to drop
    file locks held on the exported filesystem before moving clients to a
    new server.  Currently the only way to do that is by shutting down lockd
    entirely, which is often undesireable (for example, if you want to
    continue exporting other filesystems).
    
    This patch allows the administrator to release all locks held by clients
    accessing the client through a given server ip address, by echoing that
    address to a new file, /proc/fs/nfsd/unlock_ip, as in:
    
    shell> echo 10.1.1.2 > /proc/fs/nfsd/unlock_ip
    
    The expected sequence of events can be:
    1. Tear down the IP address
    2. Unexport the path
    3. Write IP to /proc/fs/nfsd/unlock_ip to unlock files
    4. Signal peer to begin take-over.
    
    For now we only support IPv4 addresses and NFSv2/v3 (NFSv4 locks are not
    affected).
    
    Also, if unmounting the filesystem is required, we assume at step 3 that
    clients using the given server ip are the only clients holding locks on
    the given filesystem; otherwise, an additional patch is required to
    allow revoking all locks held by lockd on a given filesystem.
    Signed-off-by: default avatarS. Wendy Cheng <wcheng@redhat.com>
    Cc: Lon Hohberger  <lhh@redhat.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    
     fs/lockd/svcsubs.c          |   66 +++++++++++++++++++++++++++++++++++++++-----
     fs/nfsd/nfsctl.c            |   65 +++++++++++++++++++++++++++++++++++++++++++
     include/linux/lockd/lockd.h |    7 ++++
     3 files changed, 131 insertions(+), 7 deletions(-)
    4373ea84
svcsubs.c 8.83 KB