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

Merge tag 'for-4.15-tag' of git://

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://
  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)
ret = (curr->key.offset == index);
if (refcount_dec_and_test(&curr->refs))
if (ret)
return 1;
if (curr->key.offset == index) {
ret = 1;
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