scoutfs: fix scoutfs_item_create() item leak

We'll leak the new item if we don't have lock coverage. Move the check
around to fix this.

Signed-off-by: Mark Fasheh <mfasheh@versity.com>
This commit is contained in:
Mark Fasheh
2017-11-15 17:30:45 -06:00
committed by Zach Brown
parent e8f87ff90a
commit 457d1b54cf

View File

@@ -1082,13 +1082,13 @@ int scoutfs_item_create(struct super_block *sb, struct scoutfs_key_buf *key,
if (invalid_key_val(key, val))
return -EINVAL;
if (WARN_ON_ONCE(!lock_coverage(lock, key, DLM_LOCK_EX)))
return -EINVAL;
item = alloc_item(sb, key, val);
if (!item)
return -ENOMEM;
if (WARN_ON_ONCE(!lock_coverage(lock, key, DLM_LOCK_EX)))
return -EINVAL;
do {
spin_lock_irqsave(&cac->lock, flags);