CC: [email protected] CC: [email protected] In-Reply-To: <[email protected]> References: <[email protected]> TO: brookxu <[email protected]> TO: [email protected] TO: [email protected] CC: [email protected] CC: [email protected]
Hi brookxu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on tytso-ext4/dev] [also build test WARNING on v5.15 next-20211106] [cannot apply to tytso-fscrypt/master] [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/brookxu/ext4-fix-a-possible-ABBA-deadlock-dued-to-busy-PA/20210929-091410 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev :::::: branch date: 6 weeks ago :::::: commit date: 6 weeks ago config: i386-randconfig-c001-20210929 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498) 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/5e956ecab47126f1d065a1ac6e6d5077e02e6f87 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review brookxu/ext4-fix-a-possible-ABBA-deadlock-dued-to-busy-PA/20210929-091410 git checkout 5e956ecab47126f1d065a1ac6e6d5077e02e6f87 # 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 <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON' if (unlikely(__ret_warn_on)) \ ^ fs/ext4/mballoc.c:1915:3: note: Loop condition is false. Exiting loop WARN_ON(1); ^ include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON' __WARN(); \ ^ include/asm-generic/bug.h:96:19: note: expanded from macro '__WARN' #define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) ^ arch/x86/include/asm/bug.h:78:2: note: expanded from macro '__WARN_FLAGS' instrumentation_begin(); \ ^ include/linux/instrumentation.h:57:34: note: expanded from macro 'instrumentation_begin' # define instrumentation_begin() do { } while(0) ^ fs/ext4/mballoc.c:1915:3: note: Loop condition is false. Exiting loop WARN_ON(1); ^ include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON' __WARN(); \ ^ include/asm-generic/bug.h:96:19: note: expanded from macro '__WARN' #define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) ^ arch/x86/include/asm/bug.h:79:2: note: expanded from macro '__WARN_FLAGS' _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \ ^ arch/x86/include/asm/bug.h:25:37: note: expanded from macro '_BUG_FLAGS' #define _BUG_FLAGS(ins, flags) \ ^ fs/ext4/mballoc.c:1915:3: note: Loop condition is false. Exiting loop WARN_ON(1); ^ include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON' __WARN(); \ ^ include/asm-generic/bug.h:96:19: note: expanded from macro '__WARN' #define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) ^ arch/x86/include/asm/bug.h:81:2: note: expanded from macro '__WARN_FLAGS' instrumentation_end(); \ ^ include/linux/instrumentation.h:58:33: note: expanded from macro 'instrumentation_end' # define instrumentation_end() do { } while(0) ^ fs/ext4/mballoc.c:1915:3: note: Loop condition is false. Exiting loop WARN_ON(1); ^ include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON' __WARN(); \ ^ include/asm-generic/bug.h:96:19: note: expanded from macro '__WARN' #define __WARN() __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN)) ^ arch/x86/include/asm/bug.h:76:33: note: expanded from macro '__WARN_FLAGS' #define __WARN_FLAGS(flags) \ ^ fs/ext4/mballoc.c:1916:3: note: 14th function call argument is an uninitialized value ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0, ^ fs/ext4/ext4.h:3198:2: note: expanded from macro 'ext4_grp_locked_error' __ext4_grp_locked_error(__func__, __LINE__, sb, grp, ino, block, \ ^ fs/ext4/mballoc.c:2615:27: warning: Value stored to 'grp' during its initialization is never read [clang-analyzer-deadcode.DeadStores] struct ext4_group_info *grp = ext4_get_group_info(sb, group); ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:2615:27: note: Value stored to 'grp' during its initialization is never read struct ext4_group_info *grp = ext4_get_group_info(sb, group); ^~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:2804:4: warning: Value stored to 'lost' is never read [clang-analyzer-deadcode.DeadStores] lost = atomic_inc_return(&sbi->s_mb_lost_chunks); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:2804:4: note: Value stored to 'lost' is never read lost = atomic_inc_return(&sbi->s_mb_lost_chunks); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:3657:2: warning: Value stored to 'count' is never read [clang-analyzer-deadcode.DeadStores] count += entry->efd_count; ^ ~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:3657:2: note: Value stored to 'count' is never read count += entry->efd_count; ^ ~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:3910:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] err = PTR_ERR(bitmap_bh); ^ ~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:3910:3: note: Value stored to 'err' is never read err = PTR_ERR(bitmap_bh); ^ ~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:3915:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] err = -EIO; ^ ~~~~ fs/ext4/mballoc.c:3915:2: note: Value stored to 'err' is never read err = -EIO; ^ ~~~~ fs/ext4/mballoc.c:3960:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] err = ext4_handle_dirty_metadata(NULL, NULL, gdp_bh); ^ fs/ext4/mballoc.c:3960:2: note: Value stored to 'err' is never read >> fs/ext4/mballoc.c:4849:3: warning: Value stored to 'needed' is never read >> [clang-analyzer-deadcode.DeadStores] needed = EXT4_CLUSTERS_PER_GROUP(sb) + 1; ^ fs/ext4/mballoc.c:4849:3: note: Value stored to 'needed' is never read fs/ext4/mballoc.c:4882:2: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) { ^ include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe' n = list_next_entry(pos, member); \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:555:2: note: expanded from macro 'list_next_entry' list_entry((pos)->member.next, typeof(*(pos)), member) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:511:2: note: expanded from macro 'list_entry' container_of(ptr, type, member) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/kernel.h:494:2: note: expanded from macro 'container_of' void *__mptr = (void *)(ptr); \ ^ ~~~~~~~~~~~~~ fs/ext4/mballoc.c:4827:2: note: Taking false branch mb_debug(sb, "discard preallocation for group %u\n", group); ^ fs/ext4/mballoc.h:31:2: note: expanded from macro 'mb_debug' pr_debug("[%s/%d] EXT4-fs (%s): (%s, %d): %s: " fmt, \ ^ include/linux/printk.h:477:2: note: expanded from macro 'pr_debug' no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:140:2: note: expanded from macro 'no_printk' if (0) \ ^ fs/ext4/mballoc.c:4828:6: note: Assuming the condition is false if (list_empty(&grp->bb_prealloc_list)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:4828:2: note: Taking false branch if (list_empty(&grp->bb_prealloc_list)) ^ fs/ext4/mballoc.c:4832:6: note: Calling 'IS_ERR' if (IS_ERR(bitmap_bh)) { ^~~~~~~~~~~~~~~~~ include/linux/err.h:36:9: note: Assuming the condition is false return IS_ERR_VALUE((unsigned long)ptr); ^ include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE' #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ include/linux/err.h:36:2: note: Returning zero, which participates in a condition later return IS_ERR_VALUE((unsigned long)ptr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:4832:6: note: Returning from 'IS_ERR' if (IS_ERR(bitmap_bh)) { ^~~~~~~~~~~~~~~~~ fs/ext4/mballoc.c:4832:2: note: Taking false branch if (IS_ERR(bitmap_bh)) { ^ fs/ext4/mballoc.c:4841:6: note: Assuming 'err' is 0 if (err) { ^~~ fs/ext4/mballoc.c:4841:2: note: Taking false branch if (err) { ^ fs/ext4/mballoc.c:4848:6: note: Assuming 'needed' is not equal to 0 if (needed == 0) ^~~~~~~~~~~ fs/ext4/mballoc.c:4848:2: note: Taking false branch if (needed == 0) ^ fs/ext4/mballoc.c:4851:2: note: Calling 'INIT_LIST_HEAD' INIT_LIST_HEAD(&list); ^~~~~~~~~~~~~~~~~~~~~ include/linux/list.h:35:2: note: Left side of '||' is false WRITE_ONCE(list->next, list); ^ include/asm-generic/rwonce.h:60:2: note: expanded from macro 'WRITE_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ include/linux/list.h:35:2: note: Left side of '||' is false WRITE_ONCE(list->next, list); ^ include/asm-generic/rwonce.h:60:2: note: expanded from macro 'WRITE_ONCE' compiletime_assert_rwonce_type(x); \ ^ include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type' compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \ ^ include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word' (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ ^ include/linux/list.h:35:2: note: Left side of '||' is true WRITE_ONCE(list->next, list); ^ include/asm-generic/rwonce.h:60:2: note: expanded from macro 'WRITE_ONCE' vim +/needed +4849 fs/ext4/mballoc.c c9de560ded61fa Alex Tomas 2008-01-29 4805 c9de560ded61fa Alex Tomas 2008-01-29 4806 /* c9de560ded61fa Alex Tomas 2008-01-29 4807 * releases all preallocations in given group c9de560ded61fa Alex Tomas 2008-01-29 4808 * c9de560ded61fa Alex Tomas 2008-01-29 4809 * first, we need to decide discard policy: c9de560ded61fa Alex Tomas 2008-01-29 4810 * - when do we discard c9de560ded61fa Alex Tomas 2008-01-29 4811 * 1) ENOSPC c9de560ded61fa Alex Tomas 2008-01-29 4812 * - how many do we discard c9de560ded61fa Alex Tomas 2008-01-29 4813 * 1) how many requested c9de560ded61fa Alex Tomas 2008-01-29 4814 */ 4ddfef7b41aebb Eric Sandeen 2008-04-29 4815 static noinline_for_stack int 4ddfef7b41aebb Eric Sandeen 2008-04-29 4816 ext4_mb_discard_group_preallocations(struct super_block *sb, 5e956ecab47126 Chunguang Xu 2021-09-29 4817 ext4_group_t group, int needed, int *busy) c9de560ded61fa Alex Tomas 2008-01-29 4818 { c9de560ded61fa Alex Tomas 2008-01-29 4819 struct ext4_group_info *grp = ext4_get_group_info(sb, group); c9de560ded61fa Alex Tomas 2008-01-29 4820 struct buffer_head *bitmap_bh = NULL; c9de560ded61fa Alex Tomas 2008-01-29 4821 struct ext4_prealloc_space *pa, *tmp; c9de560ded61fa Alex Tomas 2008-01-29 4822 struct list_head list; c9de560ded61fa Alex Tomas 2008-01-29 4823 struct ext4_buddy e4b; c9de560ded61fa Alex Tomas 2008-01-29 4824 int err; 5e956ecab47126 Chunguang Xu 2021-09-29 4825 int free = 0; c9de560ded61fa Alex Tomas 2008-01-29 4826 d3df14535f4a5b Ritesh Harjani 2020-05-10 4827 mb_debug(sb, "discard preallocation for group %u\n", group); c9de560ded61fa Alex Tomas 2008-01-29 4828 if (list_empty(&grp->bb_prealloc_list)) bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4829 goto out_dbg; c9de560ded61fa Alex Tomas 2008-01-29 4830 574ca174c97f79 Theodore Ts'o 2008-07-11 4831 bitmap_bh = ext4_read_block_bitmap(sb, group); 9008a58e5dcee0 Darrick J. Wong 2015-10-17 4832 if (IS_ERR(bitmap_bh)) { 9008a58e5dcee0 Darrick J. Wong 2015-10-17 4833 err = PTR_ERR(bitmap_bh); 54d3adbc29f0c7 Theodore Ts'o 2020-03-28 4834 ext4_error_err(sb, -err, 54d3adbc29f0c7 Theodore Ts'o 2020-03-28 4835 "Error %d reading block bitmap for %u", 9008a58e5dcee0 Darrick J. Wong 2015-10-17 4836 err, group); bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4837 goto out_dbg; c9de560ded61fa Alex Tomas 2008-01-29 4838 } c9de560ded61fa Alex Tomas 2008-01-29 4839 c9de560ded61fa Alex Tomas 2008-01-29 4840 err = ext4_mb_load_buddy(sb, group, &e4b); ce89f46cb833f8 Aneesh Kumar K.V 2008-07-23 4841 if (err) { 9651e6b2e20648 Konstantin Khlebnikov 2017-05-21 4842 ext4_warning(sb, "Error %d loading buddy information for %u", 9651e6b2e20648 Konstantin Khlebnikov 2017-05-21 4843 err, group); ce89f46cb833f8 Aneesh Kumar K.V 2008-07-23 4844 put_bh(bitmap_bh); bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4845 goto out_dbg; ce89f46cb833f8 Aneesh Kumar K.V 2008-07-23 4846 } c9de560ded61fa Alex Tomas 2008-01-29 4847 c9de560ded61fa Alex Tomas 2008-01-29 4848 if (needed == 0) 7137d7a48e2213 Theodore Ts'o 2011-09-09 @4849 needed = EXT4_CLUSTERS_PER_GROUP(sb) + 1; c9de560ded61fa Alex Tomas 2008-01-29 4850 c9de560ded61fa Alex Tomas 2008-01-29 4851 INIT_LIST_HEAD(&list); c9de560ded61fa Alex Tomas 2008-01-29 4852 ext4_lock_group(sb, group); c9de560ded61fa Alex Tomas 2008-01-29 4853 list_for_each_entry_safe(pa, tmp, c9de560ded61fa Alex Tomas 2008-01-29 4854 &grp->bb_prealloc_list, pa_group_list) { c9de560ded61fa Alex Tomas 2008-01-29 4855 spin_lock(&pa->pa_lock); c9de560ded61fa Alex Tomas 2008-01-29 4856 if (atomic_read(&pa->pa_count)) { c9de560ded61fa Alex Tomas 2008-01-29 4857 spin_unlock(&pa->pa_lock); 5e956ecab47126 Chunguang Xu 2021-09-29 4858 *busy = 1; c9de560ded61fa Alex Tomas 2008-01-29 4859 continue; c9de560ded61fa Alex Tomas 2008-01-29 4860 } c9de560ded61fa Alex Tomas 2008-01-29 4861 if (pa->pa_deleted) { c9de560ded61fa Alex Tomas 2008-01-29 4862 spin_unlock(&pa->pa_lock); c9de560ded61fa Alex Tomas 2008-01-29 4863 continue; c9de560ded61fa Alex Tomas 2008-01-29 4864 } c9de560ded61fa Alex Tomas 2008-01-29 4865 c9de560ded61fa Alex Tomas 2008-01-29 4866 /* seems this one can be freed ... */ 27bc446e2def38 brookxu 2020-08-17 4867 ext4_mb_mark_pa_deleted(sb, pa); c9de560ded61fa Alex Tomas 2008-01-29 4868 70022da804f0f3 Ye Bin 2020-09-16 4869 if (!free) 70022da804f0f3 Ye Bin 2020-09-16 4870 this_cpu_inc(discard_pa_seq); 70022da804f0f3 Ye Bin 2020-09-16 4871 c9de560ded61fa Alex Tomas 2008-01-29 4872 /* we can trust pa_free ... */ c9de560ded61fa Alex Tomas 2008-01-29 4873 free += pa->pa_free; c9de560ded61fa Alex Tomas 2008-01-29 4874 c9de560ded61fa Alex Tomas 2008-01-29 4875 spin_unlock(&pa->pa_lock); c9de560ded61fa Alex Tomas 2008-01-29 4876 c9de560ded61fa Alex Tomas 2008-01-29 4877 list_del(&pa->pa_group_list); c9de560ded61fa Alex Tomas 2008-01-29 4878 list_add(&pa->u.pa_tmp_list, &list); c9de560ded61fa Alex Tomas 2008-01-29 4879 } c9de560ded61fa Alex Tomas 2008-01-29 4880 c9de560ded61fa Alex Tomas 2008-01-29 4881 /* now free all selected PAs */ c9de560ded61fa Alex Tomas 2008-01-29 4882 list_for_each_entry_safe(pa, tmp, &list, u.pa_tmp_list) { c9de560ded61fa Alex Tomas 2008-01-29 4883 c9de560ded61fa Alex Tomas 2008-01-29 4884 /* remove from object (inode or locality group) */ c9de560ded61fa Alex Tomas 2008-01-29 4885 spin_lock(pa->pa_obj_lock); c9de560ded61fa Alex Tomas 2008-01-29 4886 list_del_rcu(&pa->pa_inode_list); c9de560ded61fa Alex Tomas 2008-01-29 4887 spin_unlock(pa->pa_obj_lock); c9de560ded61fa Alex Tomas 2008-01-29 4888 cc0fb9ad7dbc5a Aneesh Kumar K.V 2009-03-27 4889 if (pa->pa_type == MB_GROUP_PA) 3e1e5f50163246 Eric Sandeen 2010-10-27 4890 ext4_mb_release_group_pa(&e4b, pa); c9de560ded61fa Alex Tomas 2008-01-29 4891 else 3e1e5f50163246 Eric Sandeen 2010-10-27 4892 ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa); c9de560ded61fa Alex Tomas 2008-01-29 4893 c9de560ded61fa Alex Tomas 2008-01-29 4894 list_del(&pa->u.pa_tmp_list); c9de560ded61fa Alex Tomas 2008-01-29 4895 call_rcu(&(pa)->u.pa_rcu, ext4_mb_pa_callback); c9de560ded61fa Alex Tomas 2008-01-29 4896 } c9de560ded61fa Alex Tomas 2008-01-29 4897 c9de560ded61fa Alex Tomas 2008-01-29 4898 ext4_unlock_group(sb, group); e39e07fdfd98be Jing Zhang 2010-05-14 4899 ext4_mb_unload_buddy(&e4b); c9de560ded61fa Alex Tomas 2008-01-29 4900 put_bh(bitmap_bh); bbc4ec77e9f9c7 Ritesh Harjani 2020-05-10 4901 out_dbg: d3df14535f4a5b Ritesh Harjani 2020-05-10 4902 mb_debug(sb, "discarded (%d) blocks preallocated for group %u bb_free (%d)\n", 5e956ecab47126 Chunguang Xu 2021-09-29 4903 free, group, grp->bb_free); 5e956ecab47126 Chunguang Xu 2021-09-29 4904 return free; c9de560ded61fa Alex Tomas 2008-01-29 4905 } c9de560ded61fa Alex Tomas 2008-01-29 4906 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
