@@ -214,22 +214,22 @@ static bool sanity_check_compress_inode(struct inode *inode,
214
214
f2fs_warn (sbi ,
215
215
"%s: inode (ino=%lx) has unsupported compress algorithm: %u, run fsck to fix" ,
216
216
__func__ , inode -> i_ino , ri -> i_compress_algorithm );
217
- goto err ;
217
+ return false ;
218
218
}
219
219
if (le64_to_cpu (ri -> i_compr_blocks ) >
220
220
SECTOR_TO_BLOCK (inode -> i_blocks )) {
221
221
f2fs_warn (sbi ,
222
222
"%s: inode (ino=%lx) has inconsistent i_compr_blocks:%llu, i_blocks:%llu, run fsck to fix" ,
223
223
__func__ , inode -> i_ino , le64_to_cpu (ri -> i_compr_blocks ),
224
224
SECTOR_TO_BLOCK (inode -> i_blocks ));
225
- goto err ;
225
+ return false ;
226
226
}
227
227
if (ri -> i_log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
228
228
ri -> i_log_cluster_size > MAX_COMPRESS_LOG_SIZE ) {
229
229
f2fs_warn (sbi ,
230
230
"%s: inode (ino=%lx) has unsupported log cluster size: %u, run fsck to fix" ,
231
231
__func__ , inode -> i_ino , ri -> i_log_cluster_size );
232
- goto err ;
232
+ return false ;
233
233
}
234
234
235
235
clevel = le16_to_cpu (ri -> i_compress_flag ) >>
@@ -273,8 +273,6 @@ static bool sanity_check_compress_inode(struct inode *inode,
273
273
err_level :
274
274
f2fs_warn (sbi , "%s: inode (ino=%lx) has unsupported compress level: %u, run fsck to fix" ,
275
275
__func__ , inode -> i_ino , clevel );
276
- err :
277
- set_sbi_flag (sbi , SBI_NEED_FSCK );
278
276
return false;
279
277
}
280
278
@@ -287,14 +285,12 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
287
285
288
286
iblocks = le64_to_cpu (F2FS_INODE (node_page )-> i_blocks );
289
287
if (!iblocks ) {
290
- set_sbi_flag (sbi , SBI_NEED_FSCK );
291
288
f2fs_warn (sbi , "%s: corrupted inode i_blocks i_ino=%lx iblocks=%llu, run fsck to fix." ,
292
289
__func__ , inode -> i_ino , iblocks );
293
290
return false;
294
291
}
295
292
296
293
if (ino_of_node (node_page ) != nid_of_node (node_page )) {
297
- set_sbi_flag (sbi , SBI_NEED_FSCK );
298
294
f2fs_warn (sbi , "%s: corrupted inode footer i_ino=%lx, ino,nid: [%u, %u] run fsck to fix." ,
299
295
__func__ , inode -> i_ino ,
300
296
ino_of_node (node_page ), nid_of_node (node_page ));
@@ -303,15 +299,13 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
303
299
304
300
if (f2fs_has_extra_attr (inode )) {
305
301
if (!f2fs_sb_has_extra_attr (sbi )) {
306
- set_sbi_flag (sbi , SBI_NEED_FSCK );
307
302
f2fs_warn (sbi , "%s: inode (ino=%lx) is with extra_attr, but extra_attr feature is off" ,
308
303
__func__ , inode -> i_ino );
309
304
return false;
310
305
}
311
306
if (fi -> i_extra_isize > F2FS_TOTAL_EXTRA_ATTR_SIZE ||
312
307
fi -> i_extra_isize < F2FS_MIN_EXTRA_ATTR_SIZE ||
313
308
fi -> i_extra_isize % sizeof (__le32 )) {
314
- set_sbi_flag (sbi , SBI_NEED_FSCK );
315
309
f2fs_warn (sbi , "%s: inode (ino=%lx) has corrupted i_extra_isize: %d, max: %zu" ,
316
310
__func__ , inode -> i_ino , fi -> i_extra_isize ,
317
311
F2FS_TOTAL_EXTRA_ATTR_SIZE );
@@ -321,7 +315,6 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
321
315
f2fs_has_inline_xattr (inode ) &&
322
316
(!fi -> i_inline_xattr_size ||
323
317
fi -> i_inline_xattr_size > MAX_INLINE_XATTR_SIZE )) {
324
- set_sbi_flag (sbi , SBI_NEED_FSCK );
325
318
f2fs_warn (sbi , "%s: inode (ino=%lx) has corrupted i_inline_xattr_size: %d, max: %zu" ,
326
319
__func__ , inode -> i_ino , fi -> i_inline_xattr_size ,
327
320
MAX_INLINE_XATTR_SIZE );
@@ -335,61 +328,52 @@ static bool sanity_check_inode(struct inode *inode, struct page *node_page)
335
328
return false;
336
329
}
337
330
} else if (f2fs_sb_has_flexible_inline_xattr (sbi )) {
338
- set_sbi_flag (sbi , SBI_NEED_FSCK );
339
331
f2fs_warn (sbi , "%s: corrupted inode ino=%lx, run fsck to fix." ,
340
332
__func__ , inode -> i_ino );
341
333
return false;
342
334
}
343
335
344
336
if (!f2fs_sb_has_extra_attr (sbi )) {
345
337
if (f2fs_sb_has_project_quota (sbi )) {
346
- set_sbi_flag (sbi , SBI_NEED_FSCK );
347
338
f2fs_warn (sbi , "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix." ,
348
339
__func__ , inode -> i_ino , F2FS_FEATURE_PRJQUOTA );
349
340
return false;
350
341
}
351
342
if (f2fs_sb_has_inode_chksum (sbi )) {
352
- set_sbi_flag (sbi , SBI_NEED_FSCK );
353
343
f2fs_warn (sbi , "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix." ,
354
344
__func__ , inode -> i_ino , F2FS_FEATURE_INODE_CHKSUM );
355
345
return false;
356
346
}
357
347
if (f2fs_sb_has_flexible_inline_xattr (sbi )) {
358
- set_sbi_flag (sbi , SBI_NEED_FSCK );
359
348
f2fs_warn (sbi , "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix." ,
360
349
__func__ , inode -> i_ino , F2FS_FEATURE_FLEXIBLE_INLINE_XATTR );
361
350
return false;
362
351
}
363
352
if (f2fs_sb_has_inode_crtime (sbi )) {
364
- set_sbi_flag (sbi , SBI_NEED_FSCK );
365
353
f2fs_warn (sbi , "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix." ,
366
354
__func__ , inode -> i_ino , F2FS_FEATURE_INODE_CRTIME );
367
355
return false;
368
356
}
369
357
if (f2fs_sb_has_compression (sbi )) {
370
- set_sbi_flag (sbi , SBI_NEED_FSCK );
371
358
f2fs_warn (sbi , "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix." ,
372
359
__func__ , inode -> i_ino , F2FS_FEATURE_COMPRESSION );
373
360
return false;
374
361
}
375
362
}
376
363
377
364
if (f2fs_sanity_check_inline_data (inode )) {
378
- set_sbi_flag (sbi , SBI_NEED_FSCK );
379
365
f2fs_warn (sbi , "%s: inode (ino=%lx, mode=%u) should not have inline_data, run fsck to fix" ,
380
366
__func__ , inode -> i_ino , inode -> i_mode );
381
367
return false;
382
368
}
383
369
384
370
if (f2fs_has_inline_dentry (inode ) && !S_ISDIR (inode -> i_mode )) {
385
- set_sbi_flag (sbi , SBI_NEED_FSCK );
386
371
f2fs_warn (sbi , "%s: inode (ino=%lx, mode=%u) should not have inline_dentry, run fsck to fix" ,
387
372
__func__ , inode -> i_ino , inode -> i_mode );
388
373
return false;
389
374
}
390
375
391
376
if ((fi -> i_flags & F2FS_CASEFOLD_FL ) && !f2fs_sb_has_casefold (sbi )) {
392
- set_sbi_flag (sbi , SBI_NEED_FSCK );
393
377
f2fs_warn (sbi , "%s: inode (ino=%lx) has casefold flag, but casefold feature is off" ,
394
378
__func__ , inode -> i_ino );
395
379
return false;
@@ -477,6 +461,7 @@ static int do_read_inode(struct inode *inode)
477
461
478
462
if (!sanity_check_inode (inode , node_page )) {
479
463
f2fs_put_page (node_page , 1 );
464
+ set_sbi_flag (sbi , SBI_NEED_FSCK );
480
465
f2fs_handle_error (sbi , ERROR_CORRUPTED_INODE );
481
466
return - EFSCORRUPTED ;
482
467
}
0 commit comments