From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>,
Elena Reshetova <elena.reshetova@intel.com>
Subject: fs/inode.c:1924:45-46: WARNING: atomic_add_unless
Date: Tue, 16 Dec 2025 04:28:06 +0800 [thread overview]
Message-ID: <202512160420.AI5K5vHE-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Josef Bacik <josef@toxicpanda.com>
CC: Christian Brauner <brauner@kernel.org>
CC: Mateusz Guzik <mjguzik@gmail.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
commit: 9e70e985bdc2c6fe7a160e4d59ddd7c0a39bc077 fs: rework iput logic
date: 4 months ago
:::::: branch date: 2 days ago
:::::: commit date: 4 months ago
config: i386-randconfig-052-20251215 (https://download.01.org/0day-ci/archive/20251216/202512160420.AI5K5vHE-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202512160420.AI5K5vHE-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> fs/inode.c:1924:45-46: WARNING: atomic_add_unless
vim +1924 fs/inode.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 1899
^1da177e4c3f41 Linus Torvalds 2005-04-16 1900 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 1901 * iput - put an inode
^1da177e4c3f41 Linus Torvalds 2005-04-16 1902 * @inode: inode to put
^1da177e4c3f41 Linus Torvalds 2005-04-16 1903 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 1904 * Puts an inode, dropping its usage count. If the inode use count hits
^1da177e4c3f41 Linus Torvalds 2005-04-16 1905 * zero, the inode is then freed and may also be destroyed.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1906 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 1907 * Consequently, iput() can sleep.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1908 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1909 void iput(struct inode *inode)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1910 {
9e70e985bdc2c6 Josef Bacik 2025-08-26 1911 if (unlikely(!inode))
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1912 return;
9e70e985bdc2c6 Josef Bacik 2025-08-26 1913
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1914 retry:
9e70e985bdc2c6 Josef Bacik 2025-08-26 1915 lockdep_assert_not_held(&inode->i_lock);
9e70e985bdc2c6 Josef Bacik 2025-08-26 1916 VFS_BUG_ON_INODE(inode->i_state & I_CLEAR, inode);
9e70e985bdc2c6 Josef Bacik 2025-08-26 1917 /*
9e70e985bdc2c6 Josef Bacik 2025-08-26 1918 * Note this assert is technically racy as if the count is bogusly
9e70e985bdc2c6 Josef Bacik 2025-08-26 1919 * equal to one, then two CPUs racing to further drop it can both
9e70e985bdc2c6 Josef Bacik 2025-08-26 1920 * conclude it's fine.
9e70e985bdc2c6 Josef Bacik 2025-08-26 1921 */
9e70e985bdc2c6 Josef Bacik 2025-08-26 1922 VFS_BUG_ON_INODE(atomic_read(&inode->i_count) < 1, inode);
9e70e985bdc2c6 Josef Bacik 2025-08-26 1923
9e70e985bdc2c6 Josef Bacik 2025-08-26 @1924 if (atomic_add_unless(&inode->i_count, -1, 1))
9e70e985bdc2c6 Josef Bacik 2025-08-26 1925 return;
9e70e985bdc2c6 Josef Bacik 2025-08-26 1926
9e70e985bdc2c6 Josef Bacik 2025-08-26 1927 if ((inode->i_state & I_DIRTY_TIME) && inode->i_nlink) {
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1928 trace_writeback_lazytime_iput(inode);
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1929 mark_inode_dirty_sync(inode);
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1930 goto retry;
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1931 }
9e70e985bdc2c6 Josef Bacik 2025-08-26 1932
9e70e985bdc2c6 Josef Bacik 2025-08-26 1933 spin_lock(&inode->i_lock);
9e70e985bdc2c6 Josef Bacik 2025-08-26 1934 if (unlikely((inode->i_state & I_DIRTY_TIME) && inode->i_nlink)) {
9e70e985bdc2c6 Josef Bacik 2025-08-26 1935 spin_unlock(&inode->i_lock);
9e70e985bdc2c6 Josef Bacik 2025-08-26 1936 goto retry;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1937 }
9e70e985bdc2c6 Josef Bacik 2025-08-26 1938
9e70e985bdc2c6 Josef Bacik 2025-08-26 1939 if (!atomic_dec_and_test(&inode->i_count)) {
9e70e985bdc2c6 Josef Bacik 2025-08-26 1940 spin_unlock(&inode->i_lock);
9e70e985bdc2c6 Josef Bacik 2025-08-26 1941 return;
9e70e985bdc2c6 Josef Bacik 2025-08-26 1942 }
9e70e985bdc2c6 Josef Bacik 2025-08-26 1943
9e70e985bdc2c6 Josef Bacik 2025-08-26 1944 /*
9e70e985bdc2c6 Josef Bacik 2025-08-26 1945 * iput_final() drops ->i_lock, we can't assert on it as the inode may
9e70e985bdc2c6 Josef Bacik 2025-08-26 1946 * be deallocated by the time the call returns.
9e70e985bdc2c6 Josef Bacik 2025-08-26 1947 */
9e70e985bdc2c6 Josef Bacik 2025-08-26 1948 iput_final(inode);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1949 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1950 EXPORT_SYMBOL(iput);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1951
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2025-12-15 20:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 20:28 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-01-18 12:05 fs/inode.c:1924:45-46: WARNING: atomic_add_unless kernel test robot
2026-06-11 12:19 kernel test robot
2026-07-17 6:45 kernel test robot
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=202512160420.AI5K5vHE-lkp@intel.com \
--to=lkp@intel.com \
--cc=elena.reshetova@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@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.