Thread (4 messages) 4 messages, 4 authors, 2021-02-03

Re: [PATCH] btrfs: add comment on why we can return 0 if we failed to atomically lock the page in read_extent_buffer_pages()

From: David Sterba <hidden>
Date: 2021-02-03 13:29:57

On Thu, Jan 28, 2021 at 07:25:08PM +0800, Qu Wenruo wrote:
In read_extent_buffer_pages(), if we failed to lock the page atomically,
we just exit with return value 0.

This is pretty counter-intuitive, as normally if we can't lock what we
need, we would return something like -EAGAIN.

But the that return hides under (wait == WAIT_NONE) branch, which only
get triggered for readahead.

And for readahead, if we failed to lock the page, it means the extent
buffer is either being read by other thread, or has been read and is
under modification.
Either way the eb will or has been cached, thus readahead has no need to
wait for it.

This patch will add extra comment on this counter-intuitive behavior.

Reported-by: Dan Carpenter <redacted>
Signed-off-by: Qu Wenruo <redacted>
Added to misc-next, thanks, I've slightly rephrased the subject.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help