FROMGIT: f2fs: avoid EINVAL by SBI_NEED_FSCK when pinning a file
Android OTA failed due to SBI_NEED_FSCK flag when pinning the file. Let's avoid it since we can do in-place-updates. Bug: 210593661 Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> (cherry picked from commit 70da2736a4138b86a12873d33fefbb495e22e6f8 git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev) Signed-off-by: Huang Jianan <huangjianan@oppo.com> Change-Id: I3fd33c984417c10b38e23de6cec017b03d588945
This commit is contained in:
@@ -2515,6 +2515,11 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
|
|||||||
{
|
{
|
||||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||||
|
|
||||||
|
/* The below cases were checked when setting it. */
|
||||||
|
if (f2fs_is_pinned_file(inode))
|
||||||
|
return false;
|
||||||
|
if (fio && is_sbi_flag_set(sbi, SBI_NEED_FSCK))
|
||||||
|
return true;
|
||||||
if (f2fs_lfs_mode(sbi))
|
if (f2fs_lfs_mode(sbi))
|
||||||
return true;
|
return true;
|
||||||
if (S_ISDIR(inode->i_mode))
|
if (S_ISDIR(inode->i_mode))
|
||||||
@@ -2523,8 +2528,6 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
|
|||||||
return true;
|
return true;
|
||||||
if (f2fs_is_atomic_file(inode))
|
if (f2fs_is_atomic_file(inode))
|
||||||
return true;
|
return true;
|
||||||
if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* swap file is migrating in aligned write mode */
|
/* swap file is migrating in aligned write mode */
|
||||||
if (is_inode_flag_set(inode, FI_ALIGNED_WRITE))
|
if (is_inode_flag_set(inode, FI_ALIGNED_WRITE))
|
||||||
|
@@ -3250,17 +3250,17 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
|
|||||||
|
|
||||||
inode_lock(inode);
|
inode_lock(inode);
|
||||||
|
|
||||||
if (f2fs_should_update_outplace(inode, NULL)) {
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pin) {
|
if (!pin) {
|
||||||
clear_inode_flag(inode, FI_PIN_FILE);
|
clear_inode_flag(inode, FI_PIN_FILE);
|
||||||
f2fs_i_gc_failures_write(inode, 0);
|
f2fs_i_gc_failures_write(inode, 0);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (f2fs_should_update_outplace(inode, NULL)) {
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (f2fs_pin_file_control(inode, false)) {
|
if (f2fs_pin_file_control(inode, false)) {
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
goto out;
|
goto out;
|
||||||
|
Reference in New Issue
Block a user