Commit 525273fb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-4.15-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fix from David Sterba:
 "It's been reported recently that readdir can list stale entries under
  some conditions. Fix it."

* tag 'for-4.15-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  Btrfs: fix stale entries in readdir
parents 5b7d2796 e4fd493c
......@@ -1633,28 +1633,18 @@ void btrfs_readdir_put_delayed_items(struct inode *inode,
int btrfs_should_delete_dir_index(struct list_head *del_list,
u64 index)
{
struct btrfs_delayed_item *curr, *next;
int ret;
if (list_empty(del_list))
return 0;
struct btrfs_delayed_item *curr;
int ret = 0;
list_for_each_entry_safe(curr, next, del_list, readdir_list) {
list_for_each_entry(curr, del_list, readdir_list) {
if (curr->key.offset > index)
break;
list_del(&curr->readdir_list);
ret = (curr->key.offset == index);
if (refcount_dec_and_test(&curr->refs))
kfree(curr);
if (ret)
return 1;
else
continue;
if (curr->key.offset == index) {
ret = 1;
break;
}
}
return 0;
return ret;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment