diff mbox series

[f2fs-dev] f2fs: replace blk_finish_plug() with blk_flush_plug()

Message ID 20230830035248.4051323-1-guochunhai@vivo.com (mailing list archive)
State Superseded
Headers show
Series [f2fs-dev] f2fs: replace blk_finish_plug() with blk_flush_plug() | expand

Commit Message

Chunhai Guo Aug. 30, 2023, 3:52 a.m. UTC
The commit 344150999b7f ("f2fs: fix to avoid potential deadlock") only
requires unplugging current->plug. Using blk_finish_plug() is unnecessary
as it sets current->plug as NULL and prevents wb_writeback() from using
plug in subsequent loops. Instead, use blk_flush_plug() as a replacement.

Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
---
 fs/f2fs/data.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Chao Yu Aug. 30, 2023, 2:05 p.m. UTC | #1
On 2023/8/30 11:52, Chunhai Guo wrote:
> The commit 344150999b7f ("f2fs: fix to avoid potential deadlock") only
> requires unplugging current->plug. Using blk_finish_plug() is unnecessary
> as it sets current->plug as NULL and prevents wb_writeback() from using
> plug in subsequent loops. Instead, use blk_flush_plug() as a replacement.
> 
> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
> ---
>   fs/f2fs/data.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 5d9697717353..936a95464186 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3343,8 +3343,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,

It missed to cover f2fs_write_node_pages()?

Thanks,

>   		atomic_inc(&sbi->wb_sync_req[DATA]);
>   	else if (atomic_read(&sbi->wb_sync_req[DATA])) {
>   		/* to avoid potential deadlock */
> -		if (current->plug)
> -			blk_finish_plug(current->plug);
> +		blk_flush_plug(current->plug, false);
>   		goto skip_write;
>   	}
>
Chunhai Guo Aug. 31, 2023, 7:14 a.m. UTC | #2
在 2023/8/30 22:05, Chao Yu 写道:
> On 2023/8/30 11:52, Chunhai Guo wrote:
>> The commit 344150999b7f ("f2fs: fix to avoid potential deadlock") only
>> requires unplugging current->plug. Using blk_finish_plug() is unnecessary
>> as it sets current->plug as NULL and prevents wb_writeback() from using
>> plug in subsequent loops. Instead, use blk_flush_plug() as a replacement.
>>
>> Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
>> ---
>>    fs/f2fs/data.c | 3 +--
>>    1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>> index 5d9697717353..936a95464186 100644
>> --- a/fs/f2fs/data.c
>> +++ b/fs/f2fs/data.c
>> @@ -3343,8 +3343,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
> 
> It missed to cover f2fs_write_node_pages()?

Yes. Sorry that I miss it. I have sent another patch with this.

Thanks.
> 
> Thanks,
> 
>>    		atomic_inc(&sbi->wb_sync_req[DATA]);
>>    	else if (atomic_read(&sbi->wb_sync_req[DATA])) {
>>    		/* to avoid potential deadlock */
>> -		if (current->plug)
>> -			blk_finish_plug(current->plug);
>> +		blk_flush_plug(current->plug, false);
>>    		goto skip_write;
>>    	}
>>
diff mbox series

Patch

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 5d9697717353..936a95464186 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3343,8 +3343,7 @@  static int __f2fs_write_data_pages(struct address_space *mapping,
 		atomic_inc(&sbi->wb_sync_req[DATA]);
 	else if (atomic_read(&sbi->wb_sync_req[DATA])) {
 		/* to avoid potential deadlock */
-		if (current->plug)
-			blk_finish_plug(current->plug);
+		blk_flush_plug(current->plug, false);
 		goto skip_write;
 	}