> -----Original Message----- > From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Sent: Thursday, March 17, 2022 4:44 PM > To: kbuild@xxxxxxxxxxxx; 常凤楠 <changfengnan@xxxxxxxx> > Cc: lkp@xxxxxxxxx; kbuild-all@xxxxxxxxxxxx; Linux Memory Management List > <linux-mm@xxxxxxxxx>; Jaegeuk Kim <jaegeuk@xxxxxxxxxx>; Chao Yu > <yuchao0@xxxxxxxxxx>; Chao Yu <chao@xxxxxxxxxx> > Subject: [kbuild] [linux-next:master 11491/13209] fs/f2fs/file.c:2057 > f2fs_ioc_start_atomic_write() warn: inconsistent returns '&inode->i_rwsem'. > > [ I never understand these emails which are about patch 11491/13209... > - dan ] > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > master > head: 8a11187eb62b8b910d2c5484e1f5d160e8b11eb4 > commit: a6f748c35eca6eedf2dda8b2a30abd640f1249dc [11491/13209] f2fs: > fix compressed file start atomic write may cause data corruption > config: parisc-randconfig-m031-20220317 > (https://download.01.org/0day-ci/archive/20220317/202203171137.0LDg0sYz > -lkp@xxxxxxxxx/config ) > compiler: hppa-linux-gcc (GCC) 11.2.0 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@xxxxxxxxx> > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Thanks for report, it's my mistake, I'll fix this in new version. Thanks. > New smatch warnings: > fs/f2fs/file.c:2057 f2fs_ioc_start_atomic_write() warn: inconsistent returns > '&inode->i_rwsem'. > > vim +2057 fs/f2fs/file.c > > 88b88a667971599 Jaegeuk Kim 2014-10-06 1989 static int > f2fs_ioc_start_atomic_write(struct file *filp) > 88b88a667971599 Jaegeuk Kim 2014-10-06 1990 { > 88b88a667971599 Jaegeuk Kim 2014-10-06 1991 struct inode > *inode = file_inode(filp); > 984fc4e76d63345 Chao Yu 2022-02-04 1992 struct > user_namespace *mnt_userns = file_mnt_user_ns(filp); > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 1993 struct > f2fs_inode_info *fi = F2FS_I(inode); > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 1994 struct f2fs_sb_info > *sbi = F2FS_I_SB(inode); > f4c9c743acedc2f Chao Yu 2015-07-17 1995 int ret; > 88b88a667971599 Jaegeuk Kim 2014-10-06 1996 > 984fc4e76d63345 Chao Yu 2022-02-04 1997 if > (!inode_owner_or_capable(mnt_userns, inode)) > 88b88a667971599 Jaegeuk Kim 2014-10-06 1998 return > -EACCES; > 88b88a667971599 Jaegeuk Kim 2014-10-06 1999 > e811898c97f83ae Jaegeuk Kim 2017-03-17 2000 if > (!S_ISREG(inode->i_mode)) > e811898c97f83ae Jaegeuk Kim 2017-03-17 2001 return > -EINVAL; > e811898c97f83ae Jaegeuk Kim 2017-03-17 2002 > 038d06984f5c50a Chao Yu 2019-07-25 2003 if (filp->f_flags & > O_DIRECT) > 038d06984f5c50a Chao Yu 2019-07-25 2004 return > -EINVAL; > 038d06984f5c50a Chao Yu 2019-07-25 2005 > 7fb17fe44b70c85 Chao Yu 2016-05-09 2006 ret = > mnt_want_write_file(filp); > 7fb17fe44b70c85 Chao Yu 2016-05-09 2007 if (ret) > 7fb17fe44b70c85 Chao Yu 2016-05-09 2008 return ret; > 7fb17fe44b70c85 Chao Yu 2016-05-09 2009 > 0fac558b9658479 Chao Yu 2016-05-09 2010 inode_lock(inode); > > ^^^^^^^^^^^^^^^^^^ > > 0fac558b9658479 Chao Yu 2016-05-09 2011 > a6f748c35eca6ee Fengnan Chang 2022-03-10 2012 if > (!f2fs_disable_compressed_file(inode)) > a6f748c35eca6ee Fengnan Chang 2022-03-10 2013 return > -EINVAL; > > ^^^^^^^^^^^^^^^ goto out? > > 4c8ff7095bef64f Chao Yu 2019-11-01 2014 > 455e3a5887ee7eb Jaegeuk Kim 2018-07-27 2015 if > (f2fs_is_atomic_file(inode)) { > 455e3a5887ee7eb Jaegeuk Kim 2018-07-27 2016 if > (is_inode_flag_set(inode, FI_ATOMIC_REVOKE_REQUEST)) > 455e3a5887ee7eb Jaegeuk Kim 2018-07-27 2017 ret = > -EINVAL; > 7fb17fe44b70c85 Chao Yu 2016-05-09 2018 goto out; > 455e3a5887ee7eb Jaegeuk Kim 2018-07-27 2019 } > 88b88a667971599 Jaegeuk Kim 2014-10-06 2020 > f4c9c743acedc2f Chao Yu 2015-07-17 2021 ret = > f2fs_convert_inline_inode(inode); > f4c9c743acedc2f Chao Yu 2015-07-17 2022 if (ret) > 7fb17fe44b70c85 Chao Yu 2016-05-09 2023 goto out; > 88b88a667971599 Jaegeuk Kim 2014-10-06 2024 > e4544b63a7ee49e Tim Murray 2022-01-07 2025 > f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); > 6f8d4455060dfb0 Jaegeuk Kim 2018-07-25 2026 > 31867b23d7d1ee3 Jaegeuk Kim 2018-12-28 2027 /* > 31867b23d7d1ee3 Jaegeuk Kim 2018-12-28 2028 * Should wait > end_io to count F2FS_WB_CP_DATA correctly by > 31867b23d7d1ee3 Jaegeuk Kim 2018-12-28 2029 * > f2fs_is_atomic_file. > 31867b23d7d1ee3 Jaegeuk Kim 2018-12-28 2030 */ > 31867b23d7d1ee3 Jaegeuk Kim 2018-12-28 2031 if > (get_dirty_pages(inode)) > dcbb4c10e6d9693 Joe Perches 2019-06-18 2032 > f2fs_warn(F2FS_I_SB(inode), "Unexpected flush for atomic writes: > ino=%lu, npages=%u", > c27753d675fccd3 Jaegeuk Kim 2016-04-12 2033 > inode->i_ino, get_dirty_pages(inode)); > c27753d675fccd3 Jaegeuk Kim 2016-04-12 2034 ret = > filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); > 6f8d4455060dfb0 Jaegeuk Kim 2018-07-25 2035 if (ret) { > e4544b63a7ee49e Tim Murray 2022-01-07 2036 > f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); > 684ca7e55de1f3d Kinglong Mee 2017-03-18 2037 goto out; > 6f8d4455060dfb0 Jaegeuk Kim 2018-07-25 2038 } > 31867b23d7d1ee3 Jaegeuk Kim 2018-12-28 2039 > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 2040 > spin_lock(&sbi->inode_lock[ATOMIC_FILE]); > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 2041 if > (list_empty(&fi->inmem_ilist)) > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 2042 > list_add_tail(&fi->inmem_ilist, &sbi->inode_list[ATOMIC_FILE]); > 677017d196ba2a4 Sahitya Tummala 2019-11-13 2043 > sbi->atomic_files++; > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 2044 > spin_unlock(&sbi->inode_lock[ATOMIC_FILE]); > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 2045 > 743b620cb0516f6 Jaegeuk Kim 2019-09-09 2046 /* add inode in > inmem_list first and set atomic_file */ > 054afda9991786e Yunlei He 2018-04-18 2047 > set_inode_flag(inode, FI_ATOMIC_FILE); > 2ef79ecb5e906d8 Chao Yu 2018-05-07 2048 > clear_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST); > e4544b63a7ee49e Tim Murray 2022-01-07 2049 > f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); > 684ca7e55de1f3d Kinglong Mee 2017-03-18 2050 > 6f8d4455060dfb0 Jaegeuk Kim 2018-07-25 2051 > f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); > 7a10f0177e117e9 Jaegeuk Kim 2017-07-24 2052 > F2FS_I(inode)->inmem_task = current; > 26a28a0c1eb756b Jaegeuk Kim 2016-12-28 2053 > stat_update_max_atomic_write(inode); > 684ca7e55de1f3d Kinglong Mee 2017-03-18 2054 out: > 0fac558b9658479 Chao Yu 2016-05-09 2055 > inode_unlock(inode); > 7fb17fe44b70c85 Chao Yu 2016-05-09 2056 > mnt_drop_write_file(filp); > c27753d675fccd3 Jaegeuk Kim 2016-04-12 @2057 return ret; > 88b88a667971599 Jaegeuk Kim 2014-10-06 2058 } > > --- > 0-DAY CI Kernel Test Service > https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx > _______________________________________________ > kbuild mailing list -- kbuild@xxxxxxxxxxxx To unsubscribe send an email to > kbuild-leave@xxxxxxxxxxxx