Refresh

This website lore-kernel.gnuweeb.org/all/202410172117.cBYQGs00-lkp@intel.com/ is currently offline. Cloudflare\'s Always Online™ shows a snapshot of this web page from the Internet Archive\'s Wayback Machine. To check for the live version, click Refresh.

All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Christian Brauner <brauner@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Christian Brauner <christianvanbrauner@gmail.com>
Subject: [brauner-github:vfs.file 3/3] fs/file.c:86: warning: Function parameter or struct member 'cnt' not described in '__file_ref_put'
Date: Thu, 17 Oct 2024 21:22:03 +0800	[thread overview]
Message-ID: <202410172117.cBYQGs00-lkp@intel.com> (raw)

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

                 reply	other threads:[~2024-10-17 13:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410172117.cBYQGs00-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=brauner@kernel.org \
    --cc=christianvanbrauner@gmail.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.