ext4: fix bh ref count on error paths
diff mbox series

Message ID 1614678151-70481-1-git-send-email-zhangzl2013@126.com
State Accepted
Commit c915fb80eaa6194fa9bd0a4487705cd5b0dda2f1
Headers show
Series
  • ext4: fix bh ref count on error paths
Related show

Commit Message

Zhaolong Zhang March 2, 2021, 9:42 a.m. UTC
__ext4_journalled_writepage should drop bhs' ref count on error paths

Signed-off-by: Zhaolong Zhang <zhangzl2013@126.com>
---
 fs/ext4/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Theodore Ts'o March 5, 2021, 2:39 p.m. UTC | #1
On Tue, Mar 02, 2021 at 05:42:31PM +0800, Zhaolong Zhang wrote:
> __ext4_journalled_writepage should drop bhs' ref count on error paths
> 
> Signed-off-by: Zhaolong Zhang <zhangzl2013@126.com>

Thanks, applied.

				- Ted

Patch
diff mbox series

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 650c5acd2f2d..a79a9ea58c56 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1938,13 +1938,13 @@  static int __ext4_journalled_writepage(struct page *page,
 	if (!ret)
 		ret = err;
 
-	if (!ext4_has_inline_data(inode))
-		ext4_walk_page_buffers(NULL, page_bufs, 0, len,
-				       NULL, bput_one);
 	ext4_set_inode_state(inode, EXT4_STATE_JDATA);
 out:
 	unlock_page(page);
 out_no_pagelock:
+	if (!inline_data && page_bufs)
+		ext4_walk_page_buffers(NULL, page_bufs, 0, len,
+				       NULL, bput_one);
 	brelse(inode_bh);
 	return ret;
 }