scoutfs: use trylock for global server lock

Shared unmount hasn't worked for a long time because we didn't have the
server work woken out of blocking trying to acquire the lock.  In the
old lock code the wait conditions didn't test ->shutdown.

dlmglue doesn't give us a reasonable way to break a caller out of a
blocked lock.  We could add some code to do it with a global context
that'd have to wake all locks or add a call with a lock resource name,
not a held lock, that'd wake that specific lock.  Neither sound great.

So instead we'll use trylock to get the server lock.  It's guaranteed to
make reasonble forward progress.  The server work is already requeued
with a delay to retry.

While we're at it we add a global server lock instead of using the weird
magical inode lock in the fs space.  The server lock doesn't need keys
or to participate in item cache consistency, etc.

With this unmount works.  All mounts will now generate regular
background trylock requests.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-09-07 11:10:22 -07:00
committed by Mark Fasheh
parent 28a6b82690
commit 1da18d17cf
2 changed files with 4 additions and 2 deletions

View File

@@ -535,6 +535,7 @@ enum {
#define SCOUTFS_LOCK_SCOPE_FS_ITEMS 2
#define SCOUTFS_LOCK_TYPE_GLOBAL_RENAME 1
#define SCOUTFS_LOCK_TYPE_GLOBAL_SERVER 2
struct scoutfs_lock_name {
__u8 scope;

View File

@@ -892,8 +892,9 @@ static void scoutfs_server_func(struct work_struct *work)
init_waitqueue_head(&waitq);
/* lock attempt will return -ESHUTDOWN once we should not queue */
ret = scoutfs_lock_ino(sb, DLM_LOCK_EX, 0, ~0ULL, &lock);
ret = scoutfs_lock_global(sb, DLM_LOCK_EX, SCOUTFS_LKF_TRYLOCK,
SCOUTFS_LOCK_TYPE_GLOBAL_SERVER,
&lock);
if (ret)
goto out;