[bug report] fscache: Implement volume registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello David Howells,

The patch 62ab63352350: "fscache: Implement volume registration" from
Oct 20, 2021, leads to the following Smatch static checker warning:

	fs/fscache/volume.c:420 fscache_put_volume()
	warn: sleeping in atomic context

fs/fscache/volume.c
    409 void fscache_put_volume(struct fscache_volume *volume,
    410                         enum fscache_volume_trace where)
    411 {
    412         if (volume) {
    413                 unsigned int debug_id = volume->debug_id;
    414                 bool zero;
    415                 int ref;
    416 
    417                 zero = __refcount_dec_and_test(&volume->ref, &ref);
    418                 trace_fscache_volume(debug_id, ref - 1, where);
    419                 if (zero)
--> 420                         fscache_free_volume(volume);

fscache_free_volume() calls down_write() which sleeps.

    421         }
    422 }

The more difficult thing to explain is how this is called with preempt
disabled.  According to Smatch there are lots of callers which disable
preempt.  I have included the complete list at the end, all the
places marked as "disables preempt" apparently have a call tree from
there to fscache_put_volume().

But I have cleaned up one call tree here.

cachefiles_withdraw_objects() <- disables preempt
-> fscache_withdraw_cookie()
   -> fscache_drop_withdraw_cookie()
      -> fscache_cookie_drop_from_lru()
         -> fscache_put_cookie()
            -> fscache_put_volume()

regards,
dan carpenter

nfs_inode_set_delegation() <- disables preempt
alloc_nfs_open_dir_context() <- disables preempt
nfs_mark_dir_for_revalidate() <- disables preempt
nfs_drop_nlink() <- disables preempt
nfs_rename() <- disables preempt
nfs_zap_caches() <- disables preempt
nfs_set_inode_stale() <- disables preempt
nfs_setattr_update_inode() <- disables preempt
nfs_refresh_inode() <- disables preempt
nfs_post_op_update_inode() <- disables preempt
nfs_post_op_update_inode_force_wcc() <- disables preempt
nfs_writeback_update_inode() <- disables preempt
-> nfs_post_op_update_inode_force_wcc_locked()
   -> nfs_post_op_update_inode_locked()
      -> nfs_refresh_inode_locked()
         -> nfs_update_inode()
            -> nfs_set_inode_stale_locked()
               -> nfs_zap_caches_locked()
nfs_zap_mapping() <- disables preempt
nfs_invalidate_atime() <- disables preempt
nfs_setattr_update_inode() <- disables preempt <duplicate>
nfs_inode_attach_open_context() <- disables preempt
nfs_update_inode() <duplicate>
-> nfs_wcc_update_inode()
nfs_refresh_inode_locked() <duplicate>
-> nfs_check_inode_attributes()
nfs_post_op_update_inode_locked() <duplicate>
nfs_update_inode() <duplicate>
nfs4_inc_nlink() <- disables preempt
nfs4_do_create() <- disables preempt
-> nfs4_inc_nlink_locked()
_nfs4_proc_remove() <- disables preempt
-> nfs4_dec_nlink_locked()
nfs4_update_changeattr() <- disables preempt
_nfs4_proc_remove() <- disables preempt <duplicate>
nfs4_do_create() <- disables preempt <duplicate>
-> nfs4_update_changeattr_locked()
__nfs4_proc_set_acl() <- disables preempt
_nfs42_proc_fallocate() <- disables preempt
nfs42_copy_dest_done() <- disables preempt
nfs_sillyrename() <- disables preempt
nfs_set_pageerror() <- disables preempt
nfs_writeback_done() <- disables preempt
                  -> nfs_set_cache_invalid()
                     -> nfs_fscache_invalidate()
                        -> fscache_invalidate()
                           -> __fscache_invalidate() <- disables preempt
                              -> fscache_begin_cookie_access()
fscache_cookie_state_machine() <- disables preempt
                                 -> fscache_end_cookie_access()
cachefiles_withdraw_objects() <- disables preempt
-> fscache_withdraw_cookie()
   -> fscache_drop_withdraw_cookie()
      -> __fscache_withdraw_cookie()
__fscache_invalidate() <duplicate>
                                    -> fscache_queue_cookie()
                                       -> __fscache_queue_cookie()
fscache_drop_withdraw_cookie() <duplicate>
-> fscache_cookie_drop_from_lru()
                                          -> fscache_put_cookie()
                                             -> fscache_put_volume()


--
Linux-cachefs mailing list
Linux-cachefs@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/linux-cachefs




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]
  Powered by Linux