[lkml]   [2022]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] fs-writeback: Flush plug before next iteration in wb_writeback()
在 2022/4/16 13:42, Christoph Hellwig 写道:
>> I think the root cause is fsync gets buffer head's lock without locking
>> corresponding page, fixing 'progess' and flushing plug are both
>> workarounds.
> So let's fix that.

I think adding page lock before locking buffer head is a little
difficult and risky:
1. There are too many places getting buffer head before submitting bio,
and not all filesystems behave same in readpage/writepage/write_inode.
For example, ntfs_read_block() has locked page before locking buffer
head and then submitting bh, ext4(no journal) and fat may lock buffer
head without locking page while writing inode. It's a huge work to check
all places.
2. Import page lock before locking buffer head may bring new unknown
problem(other deadlocks about page ?). Taking page lock before locking
buffer head(in all processes which can be concurrent with wb_writeback)
is a dangerous thing.

So, how about applying the safe and simple method(flush plug) for the
time being?
PS: Maybe someday buffer head is removed from all filesystems, then we
can remove this superfluous blk_flush_plug.

 \ /
  Last update: 2022-04-16 10:42    [W:0.032 / U:4.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site