tree:
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-stable.git
linux-4.14.y
head: 2116cb420405f6497f2a46c8fa5a19f2ddc10c51
commit: 285ad248f6744133988a915887f1ec35f980ee74 [927/1005] f2fs: fix to check
i_compr_blocks correctly
config: i386-randconfig-m021-20200526 (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from include/linux/printk.h:7:0,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/wait.h:7,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from fs/f2fs/inode.c:8:
fs/f2fs/inode.c: In function 'sanity_check_inode':
> include/linux/kern_levels.h:5:18: warning: format '%lu'
expects argument of type 'long unsigned int', but argument 6 has type
'blkcnt_t {aka long long unsigned int}' [-Wformat=]
#define KERN_SOH
"001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:12:22: note: in expansion of macro 'KERN_SOH'
#define KERN_WARNING KERN_SOH "4" /* warning conditions */
^~~~~~~~
> fs/f2fs/f2fs.h:1947:19: note: in expansion of macro
'KERN_WARNING'
f2fs_printk(sbi, KERN_WARNING fmt, ##__VA_ARGS__)
^~~~~~~~~~~~
> fs/f2fs/inode.c:303:4: note: in expansion of macro
'f2fs_warn'
f2fs_warn(sbi, "%s: inode (ino=%lx) has inconsistent
"
^~~~~~~~~
fs/f2fs/inode.c:304:38: note: format string is defined here
"i_compr_blocks:%llu, i_blocks:%lu, run fsck to fix",
~~^
%llu
vim +/f2fs_warn +303 fs/f2fs/inode.c
198
199 static bool sanity_check_inode(struct inode *inode, struct page *node_page)
200 {
201 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
202 struct f2fs_inode_info *fi = F2FS_I(inode);
203 struct f2fs_inode *ri = F2FS_INODE(node_page);
204 unsigned long long iblocks;
205
206 iblocks = le64_to_cpu(F2FS_INODE(node_page)->i_blocks);
207 if (!iblocks) {
208 set_sbi_flag(sbi, SBI_NEED_FSCK);
209 f2fs_warn(sbi, "%s: corrupted inode i_blocks i_ino=%lx iblocks=%llu, run
fsck to fix.",
210 __func__, inode->i_ino, iblocks);
211 return false;
212 }
213
214 if (ino_of_node(node_page) != nid_of_node(node_page)) {
215 set_sbi_flag(sbi, SBI_NEED_FSCK);
216 f2fs_warn(sbi, "%s: corrupted inode footer i_ino=%lx, ino,nid: [%u, %u] run
fsck to fix.",
217 __func__, inode->i_ino,
218 ino_of_node(node_page), nid_of_node(node_page));
219 return false;
220 }
221
222 if (f2fs_sb_has_flexible_inline_xattr(sbi)
223 && !f2fs_has_extra_attr(inode)) {
224 set_sbi_flag(sbi, SBI_NEED_FSCK);
225 f2fs_warn(sbi, "%s: corrupted inode ino=%lx, run fsck to fix.",
226 __func__, inode->i_ino);
227 return false;
228 }
229
230 if (f2fs_has_extra_attr(inode) &&
231 !f2fs_sb_has_extra_attr(sbi)) {
232 set_sbi_flag(sbi, SBI_NEED_FSCK);
233 f2fs_warn(sbi, "%s: inode (ino=%lx) is with extra_attr, but extra_attr
feature is off",
234 __func__, inode->i_ino);
235 return false;
236 }
237
238 if (fi->i_extra_isize > F2FS_TOTAL_EXTRA_ATTR_SIZE ||
239 fi->i_extra_isize % sizeof(__le32)) {
240 set_sbi_flag(sbi, SBI_NEED_FSCK);
241 f2fs_warn(sbi, "%s: inode (ino=%lx) has corrupted i_extra_isize: %d, max:
%zu",
242 __func__, inode->i_ino, fi->i_extra_isize,
243 F2FS_TOTAL_EXTRA_ATTR_SIZE);
244 return false;
245 }
246
247 if (f2fs_has_extra_attr(inode) &&
248 f2fs_sb_has_flexible_inline_xattr(sbi) &&
249 f2fs_has_inline_xattr(inode) &&
250 (!fi->i_inline_xattr_size ||
251 fi->i_inline_xattr_size > MAX_INLINE_XATTR_SIZE)) {
252 set_sbi_flag(sbi, SBI_NEED_FSCK);
253 f2fs_warn(sbi, "%s: inode (ino=%lx) has corrupted i_inline_xattr_size: %d,
max: %zu",
254 __func__, inode->i_ino, fi->i_inline_xattr_size,
255 MAX_INLINE_XATTR_SIZE);
256 return false;
257 }
258
259 if (F2FS_I(inode)->extent_tree) {
260 struct extent_info *ei = &F2FS_I(inode)->extent_tree->largest;
261
262 if (ei->len &&
263 (!f2fs_is_valid_blkaddr(sbi, ei->blk,
264 DATA_GENERIC_ENHANCE) ||
265 !f2fs_is_valid_blkaddr(sbi, ei->blk + ei->len - 1,
266 DATA_GENERIC_ENHANCE))) {
267 set_sbi_flag(sbi, SBI_NEED_FSCK);
268 f2fs_warn(sbi, "%s: inode (ino=%lx) extent info [%u, %u, %u] is incorrect,
run fsck to fix",
269 __func__, inode->i_ino,
270 ei->blk, ei->fofs, ei->len);
271 return false;
272 }
273 }
274
275 if (f2fs_has_inline_data(inode) &&
276 (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode))) {
277 set_sbi_flag(sbi, SBI_NEED_FSCK);
278 f2fs_warn(sbi, "%s: inode (ino=%lx, mode=%u) should not have inline_data,
run fsck to fix",
279 __func__, inode->i_ino, inode->i_mode);
280 return false;
281 }
282
283 if (f2fs_has_inline_dentry(inode) && !S_ISDIR(inode->i_mode)) {
284 set_sbi_flag(sbi, SBI_NEED_FSCK);
285 f2fs_warn(sbi, "%s: inode (ino=%lx, mode=%u) should not have inline_dentry,
run fsck to fix",
286 __func__, inode->i_ino, inode->i_mode);
287 return false;
288 }
289
290 if (f2fs_has_extra_attr(inode) && f2fs_sb_has_compression(sbi) &&
291 fi->i_flags & F2FS_COMPR_FL &&
292 F2FS_FITS_IN_INODE(ri, fi->i_extra_isize,
293 i_log_cluster_size)) {
294 if (ri->i_compress_algorithm >= COMPRESS_MAX) {
295 f2fs_warn(sbi, "%s: inode (ino=%lx) has unsupported "
296 "compress algorithm: %u, run fsck to fix",
297 __func__, inode->i_ino,
298 ri->i_compress_algorithm);
299 return false;
300 }
301 if (le64_to_cpu(ri->i_compr_blocks) >
302 SECTOR_TO_BLOCK(inode->i_blocks)) {
303 f2fs_warn(sbi, "%s: inode (ino=%lx) has inconsistent
"
304 "i_compr_blocks:%llu, i_blocks:%lu, run fsck to fix",
305 __func__, inode->i_ino,
306 le64_to_cpu(ri->i_compr_blocks),
307 SECTOR_TO_BLOCK(inode->i_blocks));
308 return false;
309 }
310 if (ri->i_log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
311 ri->i_log_cluster_size > MAX_COMPRESS_LOG_SIZE) {
312 f2fs_warn(sbi, "%s: inode (ino=%lx) has unsupported "
313 "log cluster size: %u, run fsck to fix",
314 __func__, inode->i_ino,
315 ri->i_log_cluster_size);
316 return false;
317 }
318 }
319
320 return true;
321 }
322
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org