tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-rewrite-indexing head: 96d4e1af98c26988d3c1b3cf688974c24de90fa9 commit: 96d4e1af98c26988d3c1b3cf688974c24de90fa9 [75/75] cachefiles: Add error injection support config: hexagon-randconfig-r041-20211014 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6c76d0101193aa4eb891a6954ff047eda2f9cf71) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=96d4e1af98c26988d3c1b3cf688974c24de90fa9 git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git git fetch --no-tags dhowells-fs fscache-rewrite-indexing git checkout 96d4e1af98c26988d3c1b3cf688974c24de90fa9 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> fs/cachefiles/io.c:477:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (pos == 0) ^~~~~~~~ fs/cachefiles/io.c:480:6: note: uninitialized use occurs here if (ret < 0) { ^~~ fs/cachefiles/io.c:477:2: note: remove the 'if' if its condition is always true if (pos == 0) ^~~~~~~~~~~~~ fs/cachefiles/io.c:422:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 warning generated. vim +477 fs/cachefiles/io.c 409 410 /* 411 * Prepare for a write to occur. 412 */ 413 static int __cachefiles_prepare_write(struct netfs_cache_resources *cres, 414 loff_t *_start, size_t *_len, loff_t i_size, 415 bool no_space_allocated_yet) 416 { 417 struct cachefiles_object *object = cachefiles_cres_object(cres); 418 struct cachefiles_cache *cache = object->volume->cache; 419 struct file *file = cachefiles_cres_file(cres); 420 loff_t start = *_start, pos; 421 size_t len = *_len, down; 422 int ret; 423 424 if (!file) { 425 if (!fscache_wait_for_operation(cres, FSCACHE_WANT_WRITE)) 426 return -ENOBUFS; 427 file = cachefiles_cres_file(cres); 428 if (!file) 429 return -ENOBUFS; 430 } 431 432 /* Round to DIO size */ 433 down = start - round_down(start, PAGE_SIZE); 434 *_start = start - down; 435 *_len = round_up(down + len, PAGE_SIZE); 436 437 /* We need to work out whether there's sufficient disk space to perform 438 * the write - but we can skip that check if we have space already 439 * allocated. 440 */ 441 if (no_space_allocated_yet) 442 goto check_space; 443 444 pos = cachefiles_inject_read_error(); 445 if (pos == 0) 446 pos = vfs_llseek(file, *_start, SEEK_DATA); 447 if (pos < 0 && pos >= (loff_t)-MAX_ERRNO) { 448 if (pos == -ENXIO) 449 goto check_space; /* Unallocated tail */ 450 trace_cachefiles_io_error(object, file_inode(file), pos, 451 cachefiles_trace_seek_error); 452 return pos; 453 } 454 if ((u64)pos >= (u64)*_start + *_len) 455 goto check_space; /* Unallocated region */ 456 457 /* We have a block that's at least partially filled - if we're low on 458 * space, we need to see if it's fully allocated. If it's not, we may 459 * want to cull it. 460 */ 461 if (cachefiles_has_space(cache, 0, *_len / PAGE_SIZE) == 0) 462 return 0; /* Enough space to simply overwrite the whole block */ 463 464 pos = cachefiles_inject_read_error(); 465 if (pos == 0) 466 pos = vfs_llseek(file, *_start, SEEK_HOLE); 467 if (pos < 0 && pos >= (loff_t)-MAX_ERRNO) { 468 trace_cachefiles_io_error(object, file_inode(file), pos, 469 cachefiles_trace_seek_error); 470 return pos; 471 } 472 if ((u64)pos >= (u64)*_start + *_len) 473 return 0; /* Fully allocated */ 474 475 /* Partially allocated, but insufficient space: cull. */ 476 pos = cachefiles_inject_remove_error(); > 477 if (pos == 0) 478 ret = vfs_fallocate(file, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 479 *_start, *_len); 480 if (ret < 0) { 481 trace_cachefiles_io_error(object, file_inode(file), ret, 482 cachefiles_trace_fallocate_error); 483 cachefiles_io_error_obj(object, 484 "CacheFiles: fallocate failed (%d)\n", ret); 485 ret = -EIO; 486 } 487 488 return ret; 489 490 check_space: 491 return cachefiles_has_space(cache, 0, *_len / PAGE_SIZE); 492 } 493 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org