Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'f2fs-for-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs

Pull f2fs fixes from Jaegeuk Kim:
"Some urgent fixes to avoid generating corrupted inodes caused by
compressed and inline_data files.

In addition, avoid a wrong error report which prevents a roll-forward
recovery"

* tag 'f2fs-for-5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
f2fs: do not count ENOENT for error case
f2fs: fix iostat related lock protection
f2fs: attach inline_data after setting compression

+32 -20
+18 -13
fs/f2fs/iostat.c
··· 91 91 unsigned int cnt; 92 92 struct f2fs_iostat_latency iostat_lat[MAX_IO_TYPE][NR_PAGE_TYPE]; 93 93 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; 94 + unsigned long flags; 94 95 95 - spin_lock_bh(&sbi->iostat_lat_lock); 96 + spin_lock_irqsave(&sbi->iostat_lat_lock, flags); 96 97 for (idx = 0; idx < MAX_IO_TYPE; idx++) { 97 98 for (io = 0; io < NR_PAGE_TYPE; io++) { 98 99 cnt = io_lat->bio_cnt[idx][io]; ··· 107 106 io_lat->bio_cnt[idx][io] = 0; 108 107 } 109 108 } 110 - spin_unlock_bh(&sbi->iostat_lat_lock); 109 + spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); 111 110 112 111 trace_f2fs_iostat_latency(sbi, iostat_lat); 113 112 } ··· 116 115 { 117 116 unsigned long long iostat_diff[NR_IO_TYPE]; 118 117 int i; 118 + unsigned long flags; 119 119 120 120 if (time_is_after_jiffies(sbi->iostat_next_period)) 121 121 return; 122 122 123 123 /* Need double check under the lock */ 124 - spin_lock_bh(&sbi->iostat_lock); 124 + spin_lock_irqsave(&sbi->iostat_lock, flags); 125 125 if (time_is_after_jiffies(sbi->iostat_next_period)) { 126 - spin_unlock_bh(&sbi->iostat_lock); 126 + spin_unlock_irqrestore(&sbi->iostat_lock, flags); 127 127 return; 128 128 } 129 129 sbi->iostat_next_period = jiffies + ··· 135 133 sbi->prev_rw_iostat[i]; 136 134 sbi->prev_rw_iostat[i] = sbi->rw_iostat[i]; 137 135 } 138 - spin_unlock_bh(&sbi->iostat_lock); 136 + spin_unlock_irqrestore(&sbi->iostat_lock, flags); 139 137 140 138 trace_f2fs_iostat(sbi, iostat_diff); 141 139 ··· 147 145 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; 148 146 int i; 149 147 150 - spin_lock_bh(&sbi->iostat_lock); 148 + spin_lock_irq(&sbi->iostat_lock); 151 149 for (i = 0; i < NR_IO_TYPE; i++) { 152 150 sbi->rw_iostat[i] = 0; 153 151 sbi->prev_rw_iostat[i] = 0; 154 152 } 155 - spin_unlock_bh(&sbi->iostat_lock); 153 + spin_unlock_irq(&sbi->iostat_lock); 156 154 157 - spin_lock_bh(&sbi->iostat_lat_lock); 155 + spin_lock_irq(&sbi->iostat_lat_lock); 158 156 memset(io_lat, 0, sizeof(struct iostat_lat_info)); 159 - spin_unlock_bh(&sbi->iostat_lat_lock); 157 + spin_unlock_irq(&sbi->iostat_lat_lock); 160 158 } 161 159 162 160 void f2fs_update_iostat(struct f2fs_sb_info *sbi, 163 161 enum iostat_type type, unsigned long long io_bytes) 164 162 { 163 + unsigned long flags; 164 + 165 165 if (!sbi->iostat_enable) 166 166 return; 167 167 168 - spin_lock_bh(&sbi->iostat_lock); 168 + spin_lock_irqsave(&sbi->iostat_lock, flags); 169 169 sbi->rw_iostat[type] += io_bytes; 170 170 171 171 if (type == APP_BUFFERED_IO || type == APP_DIRECT_IO) ··· 176 172 if (type == APP_BUFFERED_READ_IO || type == APP_DIRECT_READ_IO) 177 173 sbi->rw_iostat[APP_READ_IO] += io_bytes; 178 174 179 - spin_unlock_bh(&sbi->iostat_lock); 175 + spin_unlock_irqrestore(&sbi->iostat_lock, flags); 180 176 181 177 f2fs_record_iostat(sbi); 182 178 } ··· 189 185 struct f2fs_sb_info *sbi = iostat_ctx->sbi; 190 186 struct iostat_lat_info *io_lat = sbi->iostat_io_lat; 191 187 int idx; 188 + unsigned long flags; 192 189 193 190 if (!sbi->iostat_enable) 194 191 return; ··· 207 202 idx = WRITE_ASYNC_IO; 208 203 } 209 204 210 - spin_lock_bh(&sbi->iostat_lat_lock); 205 + spin_lock_irqsave(&sbi->iostat_lat_lock, flags); 211 206 io_lat->sum_lat[idx][iotype] += ts_diff; 212 207 io_lat->bio_cnt[idx][iotype]++; 213 208 if (ts_diff > io_lat->peak_lat[idx][iotype]) 214 209 io_lat->peak_lat[idx][iotype] = ts_diff; 215 - spin_unlock_bh(&sbi->iostat_lat_lock); 210 + spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); 216 211 } 217 212 218 213 void iostat_update_and_unbind_ctx(struct bio *bio, int rw)
+11 -6
fs/f2fs/namei.c
··· 89 89 if (test_opt(sbi, INLINE_XATTR)) 90 90 set_inode_flag(inode, FI_INLINE_XATTR); 91 91 92 - if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode)) 93 - set_inode_flag(inode, FI_INLINE_DATA); 94 92 if (f2fs_may_inline_dentry(inode)) 95 93 set_inode_flag(inode, FI_INLINE_DENTRY); 96 94 ··· 105 107 106 108 f2fs_init_extent_tree(inode, NULL); 107 109 108 - stat_inc_inline_xattr(inode); 109 - stat_inc_inline_inode(inode); 110 - stat_inc_inline_dir(inode); 111 - 112 110 F2FS_I(inode)->i_flags = 113 111 f2fs_mask_flags(mode, F2FS_I(dir)->i_flags & F2FS_FL_INHERITED); 114 112 ··· 120 126 f2fs_may_compress(inode)) 121 127 set_compress_context(inode); 122 128 } 129 + 130 + /* Should enable inline_data after compression set */ 131 + if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode)) 132 + set_inode_flag(inode, FI_INLINE_DATA); 133 + 134 + stat_inc_inline_xattr(inode); 135 + stat_inc_inline_inode(inode); 136 + stat_inc_inline_dir(inode); 123 137 124 138 f2fs_set_inode_flags(inode); 125 139 ··· 327 325 if (!is_extension_exist(name, ext[i], false)) 328 326 continue; 329 327 328 + /* Do not use inline_data with compression */ 329 + stat_dec_inline_inode(inode); 330 + clear_inode_flag(inode, FI_INLINE_DATA); 330 331 set_compress_context(inode); 331 332 return; 332 333 }
+3 -1
fs/f2fs/node.c
··· 1450 1450 out_err: 1451 1451 ClearPageUptodate(page); 1452 1452 out_put_err: 1453 - f2fs_handle_page_eio(sbi, page->index, NODE); 1453 + /* ENOENT comes from read_node_page which is not an error. */ 1454 + if (err != -ENOENT) 1455 + f2fs_handle_page_eio(sbi, page->index, NODE); 1454 1456 f2fs_put_page(page, 1); 1455 1457 return ERR_PTR(err); 1456 1458 }