Skip to content

Commit 19bdba5

Browse files
author
Jaegeuk Kim
committed
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. Cc: [email protected] Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 325163e commit 19bdba5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

fs/f2fs/data.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,6 +2525,11 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
25252525
{
25262526
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
25272527

2528+
/* The below cases were checked when setting it. */
2529+
if (f2fs_is_pinned_file(inode))
2530+
return false;
2531+
if (fio && is_sbi_flag_set(sbi, SBI_NEED_FSCK))
2532+
return true;
25282533
if (f2fs_lfs_mode(sbi))
25292534
return true;
25302535
if (S_ISDIR(inode->i_mode))
@@ -2533,8 +2538,6 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
25332538
return true;
25342539
if (f2fs_is_atomic_file(inode))
25352540
return true;
2536-
if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
2537-
return true;
25382541

25392542
/* swap file is migrating in aligned write mode */
25402543
if (is_inode_flag_set(inode, FI_ALIGNED_WRITE))

fs/f2fs/file.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,17 +3145,17 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg)
31453145

31463146
inode_lock(inode);
31473147

3148-
if (f2fs_should_update_outplace(inode, NULL)) {
3149-
ret = -EINVAL;
3150-
goto out;
3151-
}
3152-
31533148
if (!pin) {
31543149
clear_inode_flag(inode, FI_PIN_FILE);
31553150
f2fs_i_gc_failures_write(inode, 0);
31563151
goto done;
31573152
}
31583153

3154+
if (f2fs_should_update_outplace(inode, NULL)) {
3155+
ret = -EINVAL;
3156+
goto out;
3157+
}
3158+
31593159
if (f2fs_pin_file_control(inode, false)) {
31603160
ret = -EAGAIN;
31613161
goto out;

0 commit comments

Comments
 (0)