diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index d097d07935600a7016183f9492237b0ac288869d..4269c348fe0b7dd342c0f1d2f8ae75e49d61ff6c 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2309,8 +2309,11 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) goto out; } - /* grab sb->s_umount to avoid racing w/ remount() */ - down_read(&sbi->sb->s_umount); + /* + * grab sb->s_umount to avoid racing w/ remount() and other shutdown + * paths. + */ + down_write(&sbi->sb->s_umount); f2fs_stop_gc_thread(sbi); f2fs_stop_discard_thread(sbi); @@ -2318,7 +2321,7 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg) f2fs_drop_discard_cmd(sbi); clear_opt(sbi, DISCARD); - up_read(&sbi->sb->s_umount); + up_write(&sbi->sb->s_umount); f2fs_update_time(sbi, REQ_TIME); out: