scoutfs: add full lock arg to _item_delete()

Add the full lock arg to _item_delete() so that it can verify lock
coverage.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2017-10-09 15:31:29 -07:00
committed by Mark Fasheh
parent 6cd64f3228
commit 9b31c9795b
6 changed files with 15 additions and 12 deletions
+2 -2
View File
@@ -467,7 +467,7 @@ static int clear_segno_free(struct super_block *sb, u64 segno)
goto out;
if (bitmap_empty((long *)frb.bits, SCOUTFS_FREE_BITS_BITS))
ret = scoutfs_item_delete(sb, &key, lock->end);
ret = scoutfs_item_delete(sb, &key, lock);
else
ret = scoutfs_item_update(sb, &key, val, lock);
if (ret)
@@ -576,7 +576,7 @@ static int clear_blkno_free(struct super_block *sb, u64 blkno)
}
if (bitmap_empty((long *)frb.bits, SCOUTFS_FREE_BITS_BITS))
ret = scoutfs_item_delete(sb, &key, lock->end);
ret = scoutfs_item_delete(sb, &key, lock);
else
ret = scoutfs_item_update(sb, &key, val, lock);
out:
+1 -1
View File
@@ -904,7 +904,7 @@ static int symlink_item_ops(struct super_block *sb, int op, u64 ino,
ret = scoutfs_item_lookup_exact(sb, &key, val, bytes,
lock);
else if (op == SYM_DELETE)
ret = scoutfs_item_delete(sb, &key, lock->end);
ret = scoutfs_item_delete(sb, &key, lock);
if (ret)
break;
+5 -5
View File
@@ -654,9 +654,9 @@ static int update_index_items(struct super_block *sb,
del_lock = find_index_lock(lock_list, type, si->item_majors[type],
si->item_minors[type], ino);
ret = scoutfs_item_delete(sb, &del, del_lock->end);
ret = scoutfs_item_delete(sb, &del, del_lock);
if (ret) {
err = scoutfs_item_delete(sb, &ins, ins_lock->end);
err = scoutfs_item_delete(sb, &ins, ins_lock);
BUG_ON(err);
}
@@ -1003,7 +1003,7 @@ static int remove_index(struct super_block *sb, u64 ino, u8 type, u64 major,
scoutfs_key_init(&key, &ikey, sizeof(ikey));
lock = find_index_lock(ind_locks, type, major, minor, ino);
ret = scoutfs_item_delete(sb, &key, lock->end);
ret = scoutfs_item_delete(sb, &key, lock);
if (ret == -ENOENT)
ret = 0;
return ret;
@@ -1218,7 +1218,7 @@ static int remove_orphan_item(struct super_block *sb, u64 ino)
init_orphan_key(&key, &okey, sbi->node_id, ino);
ret = scoutfs_item_delete(sb, &key, lock->end);
ret = scoutfs_item_delete(sb, &key, lock);
if (ret == -ENOENT)
ret = 0;
@@ -1301,7 +1301,7 @@ retry:
goto out;
#endif
ret = scoutfs_item_delete(sb, &key, lock->end);
ret = scoutfs_item_delete(sb, &key, lock);
if (ret)
goto out;
+5 -2
View File
@@ -1444,7 +1444,7 @@ out:
* deletion items for items that didn't exist in the first place.
*/
int scoutfs_item_delete(struct super_block *sb, struct scoutfs_key_buf *key,
struct scoutfs_key_buf *end)
struct scoutfs_lock *lock)
{
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);
struct item_cache *cac = sbi->item_cache;
@@ -1453,6 +1453,9 @@ int scoutfs_item_delete(struct super_block *sb, struct scoutfs_key_buf *key,
unsigned long flags;
int ret;
if (WARN_ON_ONCE(!lock_coverage(lock, key, WRITE)))
return -EINVAL;
scoutfs_kvec_init_null(del_val);
do {
@@ -1471,7 +1474,7 @@ int scoutfs_item_delete(struct super_block *sb, struct scoutfs_key_buf *key,
spin_unlock_irqrestore(&cac->lock, flags);
} while (ret == -ENODATA &&
(ret = scoutfs_manifest_read_items(sb, key, end)) == 0);
(ret = scoutfs_manifest_read_items(sb, key, lock->end)) == 0);
scoutfs_kvec_kfree(del_val);
+1 -1
View File
@@ -39,7 +39,7 @@ void scoutfs_item_delete_dirty(struct super_block *sb,
void scoutfs_item_update_dirty(struct super_block *sb,
struct scoutfs_key_buf *key, struct kvec *val);
int scoutfs_item_delete(struct super_block *sb, struct scoutfs_key_buf *key,
struct scoutfs_key_buf *end);
struct scoutfs_lock *lock);
int scoutfs_item_add_batch(struct super_block *sb, struct list_head *list,
struct scoutfs_key_buf *key, struct kvec *val);
+1 -1
View File
@@ -491,7 +491,7 @@ int scoutfs_xattr_drop(struct super_block *sb, u64 ino)
break;
}
ret = scoutfs_item_delete(sb, key, lck->end);
ret = scoutfs_item_delete(sb, key, lck);
if (ret)
break;