mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-03 06:37:00 +00:00
Tighten lock range error handling
If lock_range returns an error then the caller won't unlock the range. Make sure to unlock the range if we have it locked when we get errors that we're going to return to the caller. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+3
-3
@@ -211,9 +211,6 @@ int scoutfs_lock_range_lvb(struct super_block *sb, int mode,
|
||||
goto out;
|
||||
|
||||
if (linf->shutdown) {
|
||||
/* unlocked, but we own it */
|
||||
if (!list_empty(&lck->head))
|
||||
unlock(held, lck);
|
||||
ret = -ESHUTDOWN;
|
||||
goto out;
|
||||
}
|
||||
@@ -231,8 +228,11 @@ int scoutfs_lock_range_lvb(struct super_block *sb, int mode,
|
||||
memcpy(caller_lvb, held->fake_lvb, lvb_len);
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
if (ret < 0 && !list_empty(&lck->head))
|
||||
unlock(held, lck);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user