Revert "f2fs: avoid attaching SB_ACTIVE flag during mount/remount"
This reverts commit 42bbf0bcc2
.
This commit is contained in:
@@ -691,6 +691,9 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_QUOTA
|
#ifdef CONFIG_QUOTA
|
||||||
|
/* Needed for iput() to work correctly and not trash data */
|
||||||
|
sbi->sb->s_flags |= SB_ACTIVE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn on quotas which were not enabled for read-only mounts if
|
* Turn on quotas which were not enabled for read-only mounts if
|
||||||
* filesystem has quota feature, so that they are updated correctly.
|
* filesystem has quota feature, so that they are updated correctly.
|
||||||
|
@@ -786,6 +786,8 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_QUOTA
|
#ifdef CONFIG_QUOTA
|
||||||
|
/* Needed for iput() to work correctly and not trash data */
|
||||||
|
sbi->sb->s_flags |= SB_ACTIVE;
|
||||||
/* Turn on quotas so that they are updated correctly */
|
/* Turn on quotas so that they are updated correctly */
|
||||||
quota_enabled = f2fs_enable_quota_files(sbi, s_flags & SB_RDONLY);
|
quota_enabled = f2fs_enable_quota_files(sbi, s_flags & SB_RDONLY);
|
||||||
#endif
|
#endif
|
||||||
@@ -813,8 +815,10 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
|
|||||||
err = recover_data(sbi, &inode_list, &tmp_inode_list, &dir_list);
|
err = recover_data(sbi, &inode_list, &tmp_inode_list, &dir_list);
|
||||||
if (!err)
|
if (!err)
|
||||||
f2fs_bug_on(sbi, !list_empty(&inode_list));
|
f2fs_bug_on(sbi, !list_empty(&inode_list));
|
||||||
else
|
else {
|
||||||
f2fs_bug_on(sbi, sbi->sb->s_flags & SB_ACTIVE);
|
/* restore s_flags to let iput() trash data */
|
||||||
|
sbi->sb->s_flags = s_flags;
|
||||||
|
}
|
||||||
skip:
|
skip:
|
||||||
fix_curseg_write_pointer = !check_only || list_empty(&inode_list);
|
fix_curseg_write_pointer = !check_only || list_empty(&inode_list);
|
||||||
|
|
||||||
|
@@ -1908,15 +1908,17 @@ static int f2fs_enable_quotas(struct super_block *sb);
|
|||||||
|
|
||||||
static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
|
static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
|
||||||
{
|
{
|
||||||
|
unsigned int s_flags = sbi->sb->s_flags;
|
||||||
struct cp_control cpc;
|
struct cp_control cpc;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int ret;
|
int ret;
|
||||||
block_t unusable;
|
block_t unusable;
|
||||||
|
|
||||||
if (sbi->sb->s_flags & SB_RDONLY) {
|
if (s_flags & SB_RDONLY) {
|
||||||
f2fs_err(sbi, "checkpoint=disable on readonly fs");
|
f2fs_err(sbi, "checkpoint=disable on readonly fs");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
sbi->sb->s_flags |= SB_ACTIVE;
|
||||||
|
|
||||||
f2fs_update_time(sbi, DISABLE_TIME);
|
f2fs_update_time(sbi, DISABLE_TIME);
|
||||||
|
|
||||||
@@ -1934,13 +1936,13 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
|
|||||||
ret = sync_filesystem(sbi->sb);
|
ret = sync_filesystem(sbi->sb);
|
||||||
if (ret || err) {
|
if (ret || err) {
|
||||||
err = ret ? ret : err;
|
err = ret ? ret : err;
|
||||||
goto out;
|
goto restore_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
unusable = f2fs_get_unusable_blocks(sbi);
|
unusable = f2fs_get_unusable_blocks(sbi);
|
||||||
if (f2fs_disable_cp_again(sbi, unusable)) {
|
if (f2fs_disable_cp_again(sbi, unusable)) {
|
||||||
err = -EAGAIN;
|
err = -EAGAIN;
|
||||||
goto out;
|
goto restore_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
down_write(&sbi->gc_lock);
|
down_write(&sbi->gc_lock);
|
||||||
@@ -1956,7 +1958,8 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
|
|||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
up_write(&sbi->gc_lock);
|
up_write(&sbi->gc_lock);
|
||||||
out:
|
restore_flag:
|
||||||
|
sbi->sb->s_flags = s_flags; /* Restore SB_RDONLY status */
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user