mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-31 04:23:28 +00:00
scoutfs: fix lock name comparison
The lock name comparison had a typo where it didn't compare the second fields between the two names. Only inode index items used the second field. This bug could cause lock matching when the names don't match and trigger lock coverage warnings. While we're in there don't rely so heavily on readers knowing the relative precedence of subtraction and (magical gcc empty) ternary operators. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+4
-4
@@ -242,11 +242,11 @@ static struct scoutfs_lock *alloc_scoutfs_lock(struct super_block *sb,
|
||||
static int cmp_lock_names(struct scoutfs_lock_name *a,
|
||||
struct scoutfs_lock_name *b)
|
||||
{
|
||||
return (int)a->scope - (int)b->scope ?:
|
||||
(int)a->zone - (int)b->zone ?:
|
||||
(int)a->type - (int)b->type ?:
|
||||
return ((int)a->scope - (int)b->scope) ?:
|
||||
((int)a->zone - (int)b->zone) ?:
|
||||
((int)a->type - (int)b->type) ?:
|
||||
scoutfs_cmp_u64s(le64_to_cpu(a->first), le64_to_cpu(b->first)) ?:
|
||||
scoutfs_cmp_u64s(le64_to_cpu(b->second), le64_to_cpu(b->second));
|
||||
scoutfs_cmp_u64s(le64_to_cpu(a->second), le64_to_cpu(b->second));
|
||||
}
|
||||
|
||||
static struct scoutfs_lock *find_alloc_scoutfs_lock(struct super_block *sb,
|
||||
|
||||
Reference in New Issue
Block a user