https://github.com/torvalds/linux
Revision e4fd493c0541d36953f7b9d3bfced67a1321792f authored by Josef Bacik on 23 January 2018, 20:17:05 UTC, committed by David Sterba on 24 January 2018, 19:27:48 UTC
In fixing the readdir+pagefault deadlock I accidentally introduced a
stale entry regression in readdir.  If we get close to full for the
temporary buffer, and then skip a few delayed deletions, and then try to
add another entry that won't fit, we will emit the entries we found and
retry.  Unfortunately we delete entries from our del_list as we find
them, assuming we won't need them.  However our pos will be with
whatever our last entry was, which could be before the delayed deletions
we skipped, so the next search will add the deleted entries back into
our readdir buffer.  So instead don't delete entries we find in our
del_list so we can make sure we always find our delayed deletions.  This
is a slight perf hit for readdir with lots of pending deletions, but
hopefully this isn't a common occurrence.  If it is we can revist this
and optimize it.

cc: stable@vger.kernel.org
Fixes: 23b5ec74943f ("btrfs: fix readdir deadlock with pagefault")
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
1 parent ec35e48
History
Tip revision: e4fd493c0541d36953f7b9d3bfced67a1321792f authored by Josef Bacik on 23 January 2018, 20:17:05 UTC
Btrfs: fix stale entries in readdir
Tip revision: e4fd493
File Mode Size
.gitignore -rw-r--r-- 44 bytes
Kconfig -rw-r--r-- 3.4 KB
Makefile -rw-r--r-- 4.1 KB
blacklist.c -rw-r--r-- 4.0 KB
blacklist.h -rw-r--r-- 83 bytes
blacklist_hashes.c -rw-r--r-- 130 bytes
blacklist_nohashes.c -rw-r--r-- 85 bytes
system_certificates.S -rw-r--r-- 917 bytes
system_keyring.c -rw-r--r-- 7.5 KB

back to top