All of lore.kernel.org
 help / color / mirror / Atom feed
* [brauner-github:vfs.file 3/3] fs/file.c:86: warning: Function parameter or struct member 'cnt' not described in '__file_ref_put'
@ 2024-10-17 13:22 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-10-17 13:22 UTC (permalink / raw)
  To: Christian Brauner; +Cc: llvm, oe-kbuild-all, Christian Brauner

tree:   https://github.com/brauner/linux.git vfs.file
head:   e7aacb8102608f8026fb8cf145141460834bfac2
commit: 51b75c2e26e2f265788b5408290b015413ab2ff7 [3/3] file_ref_t: allow for valid race
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20241017/202410172117.cBYQGs00-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241017/202410172117.cBYQGs00-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410172117.cBYQGs00-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/file.c:86: warning: Function parameter or struct member 'cnt' not described in '__file_ref_put'


vim +86 fs/file.c

bef236c3c0fea5 Christian Brauner 2024-10-07   68  
bef236c3c0fea5 Christian Brauner 2024-10-07   69  /**
bef236c3c0fea5 Christian Brauner 2024-10-07   70   * __file_ref_put - Slowpath of file_ref_put()
bef236c3c0fea5 Christian Brauner 2024-10-07   71   * @ref:	Pointer to the reference count
bef236c3c0fea5 Christian Brauner 2024-10-07   72   *
bef236c3c0fea5 Christian Brauner 2024-10-07   73   * Invoked when the reference count is outside of the valid zone.
bef236c3c0fea5 Christian Brauner 2024-10-07   74   *
bef236c3c0fea5 Christian Brauner 2024-10-07   75   * Return:
bef236c3c0fea5 Christian Brauner 2024-10-07   76   *	True if this was the last reference with no future references
bef236c3c0fea5 Christian Brauner 2024-10-07   77   *	possible. This signals the caller that it can safely schedule the
bef236c3c0fea5 Christian Brauner 2024-10-07   78   *	object, which is protected by the reference counter, for
bef236c3c0fea5 Christian Brauner 2024-10-07   79   *	deconstruction.
bef236c3c0fea5 Christian Brauner 2024-10-07   80   *
bef236c3c0fea5 Christian Brauner 2024-10-07   81   *	False if there are still active references or the put() raced
bef236c3c0fea5 Christian Brauner 2024-10-07   82   *	with a concurrent get()/put() pair. Caller is not allowed to
bef236c3c0fea5 Christian Brauner 2024-10-07   83   *	deconstruct the protected object.
bef236c3c0fea5 Christian Brauner 2024-10-07   84   */
51b75c2e26e2f2 Christian Brauner 2024-10-16   85  bool __file_ref_put(file_ref_t *ref, unsigned long cnt)
bef236c3c0fea5 Christian Brauner 2024-10-07  @86  {
bef236c3c0fea5 Christian Brauner 2024-10-07   87  	/* Did this drop the last reference? */
bef236c3c0fea5 Christian Brauner 2024-10-07   88  	if (likely(cnt == FILE_REF_NOREF)) {
bef236c3c0fea5 Christian Brauner 2024-10-07   89  		/*
bef236c3c0fea5 Christian Brauner 2024-10-07   90  		 * Carefully try to set the reference count to FILE_REF_DEAD.
bef236c3c0fea5 Christian Brauner 2024-10-07   91  		 *
bef236c3c0fea5 Christian Brauner 2024-10-07   92  		 * This can fail if a concurrent get() operation has
bef236c3c0fea5 Christian Brauner 2024-10-07   93  		 * elevated it again or the corresponding put() even marked
bef236c3c0fea5 Christian Brauner 2024-10-07   94  		 * it dead already. Both are valid situations and do not
bef236c3c0fea5 Christian Brauner 2024-10-07   95  		 * require a retry. If this fails the caller is not
bef236c3c0fea5 Christian Brauner 2024-10-07   96  		 * allowed to deconstruct the object.
bef236c3c0fea5 Christian Brauner 2024-10-07   97  		 */
bef236c3c0fea5 Christian Brauner 2024-10-07   98  		if (!atomic_long_try_cmpxchg_release(&ref->refcnt, &cnt, FILE_REF_DEAD))
bef236c3c0fea5 Christian Brauner 2024-10-07   99  			return false;
bef236c3c0fea5 Christian Brauner 2024-10-07  100  
bef236c3c0fea5 Christian Brauner 2024-10-07  101  		/*
bef236c3c0fea5 Christian Brauner 2024-10-07  102  		 * The caller can safely schedule the object for
bef236c3c0fea5 Christian Brauner 2024-10-07  103  		 * deconstruction. Provide acquire ordering.
bef236c3c0fea5 Christian Brauner 2024-10-07  104  		 */
bef236c3c0fea5 Christian Brauner 2024-10-07  105  		smp_acquire__after_ctrl_dep();
bef236c3c0fea5 Christian Brauner 2024-10-07  106  		return true;
bef236c3c0fea5 Christian Brauner 2024-10-07  107  	}
bef236c3c0fea5 Christian Brauner 2024-10-07  108  
bef236c3c0fea5 Christian Brauner 2024-10-07  109  	/*
bef236c3c0fea5 Christian Brauner 2024-10-07  110  	 * If the reference count was already in the dead zone, then this
bef236c3c0fea5 Christian Brauner 2024-10-07  111  	 * put() operation is imbalanced. Warn, put the reference count back to
bef236c3c0fea5 Christian Brauner 2024-10-07  112  	 * DEAD and tell the caller to not deconstruct the object.
bef236c3c0fea5 Christian Brauner 2024-10-07  113  	 */
bef236c3c0fea5 Christian Brauner 2024-10-07  114  	if (WARN_ONCE(cnt >= FILE_REF_RELEASED, "imbalanced put on file reference count")) {
bef236c3c0fea5 Christian Brauner 2024-10-07  115  		atomic_long_set(&ref->refcnt, FILE_REF_DEAD);
bef236c3c0fea5 Christian Brauner 2024-10-07  116  		return false;
bef236c3c0fea5 Christian Brauner 2024-10-07  117  	}
bef236c3c0fea5 Christian Brauner 2024-10-07  118  
bef236c3c0fea5 Christian Brauner 2024-10-07  119  	/*
bef236c3c0fea5 Christian Brauner 2024-10-07  120  	 * This is a put() operation on a saturated refcount. Restore the
bef236c3c0fea5 Christian Brauner 2024-10-07  121  	 * mean saturation value and tell the caller to not deconstruct the
bef236c3c0fea5 Christian Brauner 2024-10-07  122  	 * object.
bef236c3c0fea5 Christian Brauner 2024-10-07  123  	 */
bef236c3c0fea5 Christian Brauner 2024-10-07  124  	if (cnt > FILE_REF_MAXREF)
bef236c3c0fea5 Christian Brauner 2024-10-07  125  		atomic_long_set(&ref->refcnt, FILE_REF_SATURATED);
bef236c3c0fea5 Christian Brauner 2024-10-07  126  	return false;
bef236c3c0fea5 Christian Brauner 2024-10-07  127  }
bef236c3c0fea5 Christian Brauner 2024-10-07  128  EXPORT_SYMBOL_GPL(__file_ref_put);
bef236c3c0fea5 Christian Brauner 2024-10-07  129  

:::::: The code at line 86 was first introduced by commit
:::::: bef236c3c0fea5fc0dce2e729c1482ca9df4d82e fs: add file_ref

:::::: TO: Christian Brauner <brauner@kernel.org>
:::::: CC: Christian Brauner <brauner@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-17 13:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 13:22 [brauner-github:vfs.file 3/3] fs/file.c:86: warning: Function parameter or struct member 'cnt' not described in '__file_ref_put' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.