Re: [PATCH 05/11] ubifs: Rename whiteout atomically

From: kernel test robot
Date: Fri Nov 05 2021 - 01:35:50 EST


Hi Zhihao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master rw-ubifs/next v5.15-rc7 next-20211029]
[cannot apply to rw-ubifs/fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Zhihao-Cheng/Some-bugfixs-for-ubifs-ubi/20211025-113114
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2f111a6fd5b5297b4e92f53798ca086f7c7d33a4
config: i386-randconfig-c001-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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://github.com/0day-ci/linux/commit/8a6ca5bc1be93cca9c7b0167a71bdd338f854600
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zhihao-Cheng/Some-bugfixs-for-ubifs-ubi/20211025-113114
git checkout 8a6ca5bc1be93cca9c7b0167a71bdd338f854600
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)

>> fs/ubifs/dir.c:379:2: warning: Value stored to 'ui' is never read [clang-analyzer-deadcode.DeadStores]
ui = ubifs_inode(inode);
^ ~~~~~~~~~~~~~~~~~~


vim +/ui +379 fs/ubifs/dir.c

1e51764a3c2ac0 Artem Bityutskiy 2008-07-14 351
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 352 static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry,
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 353 umode_t mode)
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 354 {
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 355 int err;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 356 struct inode *inode;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 357 struct ubifs_inode *ui;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 358 struct ubifs_info *c = dir->i_sb->s_fs_info;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 359 struct fscrypt_name nm;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 360
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 361 /*
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 362 * Create an inode('nlink = 1') for whiteout without updating journal,
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 363 * let ubifs_jnl_rename() store it on flash to complete rename whiteout
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 364 * atomically.
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 365 */
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 366
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 367 dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 368 dentry, mode, dir->i_ino);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 369
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 370 err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 371 if (err)
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 372 return ERR_PTR(err);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 373
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 374 inode = ubifs_new_inode(c, dir, mode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 375 if (IS_ERR(inode)) {
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 376 err = PTR_ERR(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 377 goto out_free;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 378 }
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 @379 ui = ubifs_inode(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 380
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 381 init_special_inode(inode, inode->i_mode, WHITEOUT_DEV);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 382 ubifs_assert(c, inode->i_op == &ubifs_file_inode_operations);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 383
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 384 err = ubifs_init_security(dir, inode, &dentry->d_name);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 385 if (err)
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 386 goto out_inode;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 387
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 388 /* The dir size is updated by do_rename. */
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 389 insert_inode_hash(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 390
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 391 return inode;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 392
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 393 out_inode:
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 394 make_bad_inode(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 395 iput(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 396 out_free:
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 397 fscrypt_free_filename(&nm);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 398 ubifs_err(c, "cannot create whiteout file, error %d", err);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 399 return ERR_PTR(err);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 400 }
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 401

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip