lkml.org 
[lkml]   [2018]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] f2fs: Fix deadlock in shutdown ioctl
On Thu, May 17, 2018 at 06:08:26PM -0700, Jaegeuk Kim wrote:
>
> if (in == F2FS_GOING_DOWN_FULLSYNC) {
> sb = freeze_bdev();
> if (IS_ERR(sb))
> return PTR_ERR(sb);
> if (unlikely(!sb))
> return -EINVAL;
> }
>
> ret = mnt_want_write_file();

It will be stuck/blocked here as freeze_bdev() now holds the write
lock for all the cases including SB_FREEZE_WRITE. As freeze_bdev()
holds the write lock, I think f2fs_stop_checkpoint() should be safe
even without mnt_want_write_file().

I have posted v3 as per Chao's comments to exclude mnt_want_write_file()
for F2FS_GOING_DOWN_FULLSYNC case.
Please check and let me know if there are any further comments.

> ...
> switch() {
> case F2FS_GOING_DOWN_FULLSYNC:
> f2fs_stop_checkpoint();
> dhaw_bdev();
> break;
> ...
> }
>
> drop:
> ...
>
>
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

\
 
 \ /
  Last update: 2018-05-18 09:40    [W:0.033 / U:6.608 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site