Re: [PATCH 1/2] btrfs: fix wild pointer access during metadata read failure for subpage
From: David Sterba <hidden>
Date: 2021-03-15 18:53:45
From: David Sterba <hidden>
Date: 2021-03-15 18:53:45
On Mon, Mar 15, 2021 at 04:25:32PM +0800, Qu Wenruo wrote:
On 2021/3/15 下午3:55, Johannes Thumshirn wrote:quoted
On 15/03/2021 06:40, Qu Wenruo wrote:quoted
The difference against find_extent_buffer_nospinlock() is: - Also handles regular sectorsize == PAGE_SIZE case - No extent buffer refs increase/decrease As extent buffer under IO must has non-zero refs.Can these be merged into a single function? The sectorsie == PAGE_SIZE case won't do anything for find_extent_buffer_nospinlock() and the atomic_inc_not_zero(&eb->refs) can be hidden behind a 'if (write)' check.That would make the eb refs change too inconsistent. But I get your point. How about calling find_extent_buffer_nospinlock() and then dec the refs manually?
Is this equivalent to this patch? Ie. the atomic_inc_not_zero in find_extent_buffer_nospinlock happens inside the RCU section, while what you suggest looks like find_extent_buffer_nospinlock() rcu_lock radix_lookup rcu_unlock atomic_inc_not_zero()