Skip to content

Commit 435cbab

Browse files
author
Jaegeuk Kim
committed
f2fs: fix quota_sync failure due to f2fs_lock_op
f2fs_quota_sync() uses f2fs_lock_op() before flushing dirty pages, but f2fs_write_data_page() returns EAGAIN. Likewise dentry blocks, we can just bypass getting the lock, since quota blocks are also maintained by checkpoint. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 8b83ac8 commit 435cbab

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎fs/f2fs/compress.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
985985
loff_t psize;
986986
int i, err;
987987

988-
if (!f2fs_trylock_op(sbi))
988+
if (!IS_NOQUOTA(inode) && !f2fs_trylock_op(sbi))
989989
return -EAGAIN;
990990

991991
set_new_dnode(&dn, cc->inode, NULL, NULL, 0);
@@ -1092,7 +1092,8 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
10921092
set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
10931093

10941094
f2fs_put_dnode(&dn);
1095-
f2fs_unlock_op(sbi);
1095+
if (!IS_NOQUOTA(inode))
1096+
f2fs_unlock_op(sbi);
10961097

10971098
spin_lock(&fi->i_size_lock);
10981099
if (fi->last_disk_size < psize)
@@ -1118,7 +1119,8 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,
11181119
out_put_dnode:
11191120
f2fs_put_dnode(&dn);
11201121
out_unlock_op:
1121-
f2fs_unlock_op(sbi);
1122+
if (!IS_NOQUOTA(inode))
1123+
f2fs_unlock_op(sbi);
11221124
return -EAGAIN;
11231125
}
11241126

‎fs/f2fs/data.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2659,8 +2659,8 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
26592659
f2fs_available_free_memory(sbi, BASE_CHECK))))
26602660
goto redirty_out;
26612661

2662-
/* Dentry blocks are controlled by checkpoint */
2663-
if (S_ISDIR(inode->i_mode)) {
2662+
/* Dentry/quota blocks are controlled by checkpoint */
2663+
if (S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) {
26642664
fio.need_lock = LOCK_DONE;
26652665
err = f2fs_do_write_data_page(&fio);
26662666
goto done;

0 commit comments

Comments
 (0)