The following patches address a couple of deadlocks that we've been seeing during reboot recovery and/or delegation recovery. For NFSv4, it was safe for ordinary processes to grab the nfs_inode->rwsem across an NFSv4 RPC call, since if the stateid needed recovery, the server would return an appropriate error, the rpc call would return, and the process would release the nfs_inode->rwsem so that the state recovery thread could proceed. In NFSv4.1, things get a little more interesting: the state recovery thread will block all outstanding RPC calls using the NFS4_SESSION_DRAINING flag. It needs to be able to do this so that we can safely recover session state, stateids, etc. The problem is that if a process is holding a lock, then that lock will remain held until we call nfs4_end_drain_session(). So if the recovery process needs to take that lock, we end up deadlocking... The following patchset attempts to address this issue by adjusting the locking in the state recovery and delegation recovery. Trond Myklebust (6): NFSv4: Allow the state manager to mark an open_owner as being recovered NFSv4.1: Prevent deadlocks between state recovery and file locking NFSv4.1: Don't lose locks when a server reboots during delegation return NFSv4: Fix up the return values of nfs4_open_delegation_recall NFSv4: Ensure delegation recall and byte range lock removal don't conflict NFSv4: Fix a reboot recovery race when opening a file fs/nfs/delegation.c | 154 +++++++++++++++++++++++++++++++++++++--------------- fs/nfs/delegation.h | 1 + fs/nfs/nfs4_fs.h | 4 ++ fs/nfs/nfs4proc.c | 96 +++++++++++++++++++++++--------- fs/nfs/nfs4state.c | 10 +++- 5 files changed, 193 insertions(+), 72 deletions(-) -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html