CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Nikolay Borisov <[email protected]>
TO: [email protected]
CC: Nikolay Borisov <[email protected]>

Hi Nikolay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on next-20210216]
[cannot apply to v5.11]
[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/Nikolay-Borisov/Couple-of-misc-patches/20210217-211948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: x86_64-randconfig-c002-20210217 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Julia Lawall <[email protected]>


"coccinelle warnings: (new ones prefixed by >>)"
>> fs/btrfs/block-group.c:2284:2-12: second lock on line 2284

vim +2284 fs/btrfs/block-group.c

26ce2095e03c24 Josef Bacik     2019-06-20  2253  
b12de52896c0e8 Qu Wenruo       2019-11-15  2254  /*
b12de52896c0e8 Qu Wenruo       2019-11-15  2255   * Mark one block group RO, 
can be called several times for the same block
b12de52896c0e8 Qu Wenruo       2019-11-15  2256   * group.
b12de52896c0e8 Qu Wenruo       2019-11-15  2257   *
b12de52896c0e8 Qu Wenruo       2019-11-15  2258   * @cache:             the 
destination block group
b12de52896c0e8 Qu Wenruo       2019-11-15  2259   * @do_chunk_alloc:    whether 
need to do chunk pre-allocation, this is to
b12de52896c0e8 Qu Wenruo       2019-11-15  2260   *                     ensure 
we still have some free space after marking this
b12de52896c0e8 Qu Wenruo       2019-11-15  2261   *                     block 
group RO.
b12de52896c0e8 Qu Wenruo       2019-11-15  2262   */
b12de52896c0e8 Qu Wenruo       2019-11-15  2263  int 
btrfs_inc_block_group_ro(struct btrfs_block_group *cache,
b12de52896c0e8 Qu Wenruo       2019-11-15  2264                              
bool do_chunk_alloc)
26ce2095e03c24 Josef Bacik     2019-06-20  2265  {
26ce2095e03c24 Josef Bacik     2019-06-20  2266         struct btrfs_fs_info 
*fs_info = cache->fs_info;
26ce2095e03c24 Josef Bacik     2019-06-20  2267         struct 
btrfs_trans_handle *trans;
26ce2095e03c24 Josef Bacik     2019-06-20  2268         u64 alloc_flags;
26ce2095e03c24 Josef Bacik     2019-06-20  2269         int ret;
3812e05fd27afe Nikolay Borisov 2021-02-17  2270         bool dirty_bg_running;
26ce2095e03c24 Josef Bacik     2019-06-20  2271  
3812e05fd27afe Nikolay Borisov 2021-02-17  2272         do {
26ce2095e03c24 Josef Bacik     2019-06-20  2273                 trans = 
btrfs_join_transaction(fs_info->extent_root);
26ce2095e03c24 Josef Bacik     2019-06-20  2274                 if 
(IS_ERR(trans))
26ce2095e03c24 Josef Bacik     2019-06-20  2275                         return 
PTR_ERR(trans);
26ce2095e03c24 Josef Bacik     2019-06-20  2276  
3812e05fd27afe Nikolay Borisov 2021-02-17  2277                 
dirty_bg_running = false;
3812e05fd27afe Nikolay Borisov 2021-02-17  2278  
26ce2095e03c24 Josef Bacik     2019-06-20  2279                 /*
26ce2095e03c24 Josef Bacik     2019-06-20  2280                  * we're not 
allowed to set block groups readonly after the dirty
26ce2095e03c24 Josef Bacik     2019-06-20  2281                  * block groups 
cache has started writing.  If it already started,
26ce2095e03c24 Josef Bacik     2019-06-20  2282                  * back off and 
let this transaction commit
26ce2095e03c24 Josef Bacik     2019-06-20  2283                  */
26ce2095e03c24 Josef Bacik     2019-06-20 @2284                 
mutex_lock(&fs_info->ro_block_group_mutex);
26ce2095e03c24 Josef Bacik     2019-06-20  2285                 if 
(test_bit(BTRFS_TRANS_DIRTY_BG_RUN, &trans->transaction->flags)) {
26ce2095e03c24 Josef Bacik     2019-06-20  2286                         u64 
transid = trans->transid;
26ce2095e03c24 Josef Bacik     2019-06-20  2287  
26ce2095e03c24 Josef Bacik     2019-06-20  2288                         
mutex_unlock(&fs_info->ro_block_group_mutex);
26ce2095e03c24 Josef Bacik     2019-06-20  2289                         
btrfs_end_transaction(trans);
26ce2095e03c24 Josef Bacik     2019-06-20  2290  
26ce2095e03c24 Josef Bacik     2019-06-20  2291                         ret = 
btrfs_wait_for_commit(fs_info, transid);
26ce2095e03c24 Josef Bacik     2019-06-20  2292                         if (ret)
26ce2095e03c24 Josef Bacik     2019-06-20  2293                                 
return ret;
3812e05fd27afe Nikolay Borisov 2021-02-17  2294                         
dirty_bg_running = true;
26ce2095e03c24 Josef Bacik     2019-06-20  2295                 }
3812e05fd27afe Nikolay Borisov 2021-02-17  2296         } while 
(dirty_bg_running);
26ce2095e03c24 Josef Bacik     2019-06-20  2297  
b12de52896c0e8 Qu Wenruo       2019-11-15  2298         if (do_chunk_alloc) {
26ce2095e03c24 Josef Bacik     2019-06-20  2299                 /*
b12de52896c0e8 Qu Wenruo       2019-11-15  2300                  * If we are 
changing raid levels, try to allocate a
b12de52896c0e8 Qu Wenruo       2019-11-15  2301                  * 
corresponding block group with the new raid level.
26ce2095e03c24 Josef Bacik     2019-06-20  2302                  */
349e120ecebeb9 Josef Bacik     2020-07-21  2303                 alloc_flags = 
btrfs_get_alloc_profile(fs_info, cache->flags);
26ce2095e03c24 Josef Bacik     2019-06-20  2304                 if (alloc_flags 
!= cache->flags) {
b12de52896c0e8 Qu Wenruo       2019-11-15  2305                         ret = 
btrfs_chunk_alloc(trans, alloc_flags,
b12de52896c0e8 Qu Wenruo       2019-11-15  2306                                 
                CHUNK_ALLOC_FORCE);
26ce2095e03c24 Josef Bacik     2019-06-20  2307                         /*
26ce2095e03c24 Josef Bacik     2019-06-20  2308                          * 
ENOSPC is allowed here, we may have enough space
b12de52896c0e8 Qu Wenruo       2019-11-15  2309                          * 
already allocated at the new raid level to carry on
26ce2095e03c24 Josef Bacik     2019-06-20  2310                          */
26ce2095e03c24 Josef Bacik     2019-06-20  2311                         if (ret 
== -ENOSPC)
26ce2095e03c24 Josef Bacik     2019-06-20  2312                                 
ret = 0;
26ce2095e03c24 Josef Bacik     2019-06-20  2313                         if (ret 
< 0)
26ce2095e03c24 Josef Bacik     2019-06-20  2314                                 
goto out;
26ce2095e03c24 Josef Bacik     2019-06-20  2315                 }
b12de52896c0e8 Qu Wenruo       2019-11-15  2316         }
26ce2095e03c24 Josef Bacik     2019-06-20  2317  
a7a63acc6575de Josef Bacik     2020-01-17  2318         ret = 
inc_block_group_ro(cache, 0);
df425e78f1e94a Filipe Manana   2021-02-05  2319         if (!do_chunk_alloc || 
ret == -ETXTBSY)
b12de52896c0e8 Qu Wenruo       2019-11-15  2320                 goto unlock_out;
26ce2095e03c24 Josef Bacik     2019-06-20  2321         if (!ret)
26ce2095e03c24 Josef Bacik     2019-06-20  2322                 goto out;
26ce2095e03c24 Josef Bacik     2019-06-20  2323         alloc_flags = 
btrfs_get_alloc_profile(fs_info, cache->space_info->flags);
26ce2095e03c24 Josef Bacik     2019-06-20  2324         ret = 
btrfs_chunk_alloc(trans, alloc_flags, CHUNK_ALLOC_FORCE);
26ce2095e03c24 Josef Bacik     2019-06-20  2325         if (ret < 0)
26ce2095e03c24 Josef Bacik     2019-06-20  2326                 goto out;
e11c0406ad1bb6 Josef Bacik     2019-06-20  2327         ret = 
inc_block_group_ro(cache, 0);
df425e78f1e94a Filipe Manana   2021-02-05  2328         if (ret == -ETXTBSY)
df425e78f1e94a Filipe Manana   2021-02-05  2329                 goto unlock_out;
26ce2095e03c24 Josef Bacik     2019-06-20  2330  out:
26ce2095e03c24 Josef Bacik     2019-06-20  2331         if (cache->flags & 
BTRFS_BLOCK_GROUP_SYSTEM) {
349e120ecebeb9 Josef Bacik     2020-07-21  2332                 alloc_flags = 
btrfs_get_alloc_profile(fs_info, cache->flags);
26ce2095e03c24 Josef Bacik     2019-06-20  2333                 
mutex_lock(&fs_info->chunk_mutex);
26ce2095e03c24 Josef Bacik     2019-06-20  2334                 
check_system_chunk(trans, alloc_flags);
26ce2095e03c24 Josef Bacik     2019-06-20  2335                 
mutex_unlock(&fs_info->chunk_mutex);
26ce2095e03c24 Josef Bacik     2019-06-20  2336         }
b12de52896c0e8 Qu Wenruo       2019-11-15  2337  unlock_out:
26ce2095e03c24 Josef Bacik     2019-06-20  2338         
mutex_unlock(&fs_info->ro_block_group_mutex);
26ce2095e03c24 Josef Bacik     2019-06-20  2339  
26ce2095e03c24 Josef Bacik     2019-06-20  2340         
btrfs_end_transaction(trans);
26ce2095e03c24 Josef Bacik     2019-06-20  2341         return ret;
26ce2095e03c24 Josef Bacik     2019-06-20  2342  }
26ce2095e03c24 Josef Bacik     2019-06-20  2343  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to