Re: [PATCH] f2fs: fix a deadlock in fsync

From: Jaegeuk Kim
Date: Tue Aug 06 2013 - 08:46:53 EST

Hi, Jin,

IMO, this patch tries to fix the deadlock condition on

I think the errorneous scenario is something like this.
When there remains only one fs_lock during the checkpoint procedure,
f2fs_write_data_pages successfully gets the last one at the moment.
Then, other operations like sync and writeback thread are definitely
blocked too.

Meanwhile, in the flow of f2fs_write_data_pages, it is able to wait on
writebacked node page, which is what you decribed.

If you indicated this scenario correctly, as I examined the flow again,
I found one more case, __set_data_blkaddr, in addition to the
update_inode. And, I can clean up another minor flow too.

Please check the below patch.