]> www.infradead.org Git - linux.git/commit
btrfs: add comment about locking in cow_file_range_inline()
authorBoris Burkov <boris@bur.io>
Wed, 31 Jul 2024 19:41:06 +0000 (12:41 -0700)
committerDavid Sterba <dsterba@suse.com>
Tue, 10 Sep 2024 14:51:17 +0000 (16:51 +0200)
commitf8e9f4a76df65222764c947a1b166ceebb1256dd
tree162ea56b47acd08b21d3521a7419e4b9088263f5
parent68a505bb87f948f72e5d230dfd7b40debdb195ed
btrfs: add comment about locking in cow_file_range_inline()

Add a comment to document the complicated locked_page unlock logic in
cow_file_range_inline. The specifically tricky part is that a caller
just up the stack converts ret == 0 to ret == 1 and then another
caller far up the callstack handles ret == 1 as a success, AND returns
without cleanup in that case, both of which "feel" unnatural and led to
the original bug.

Try to document that somewhat specific callstack logic here to explain
the weird un-setting of locked_folio on success.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c