* [brauner-github:vfs-6.18.inode.refcount.preliminaries 4/5] fs/inode.c:1924:45-46: WARNING: atomic_add_unless
@ 2025-08-30 23:38 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-08-30 23:38 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Julia Lawall, Elena Reshetova
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Christian Brauner <christianvanbrauner@gmail.com>
TO: Josef Bacik <josef@toxicpanda.com>
CC: Christian Brauner <brauner@kernel.org>
CC: Mateusz Guzik <mjguzik@gmail.com>
tree: https://github.com/brauner/linux.git vfs-6.18.inode.refcount.preliminaries
head: c06366d1d6aba8c5757b0a119a948ee37bfbc560
commit: 3cba19f6a00675fbc2af0987dfc90e216e6cfb74 [4/5] fs: rework iput logic
:::::: branch date: 35 hours ago
:::::: commit date: 35 hours ago
config: x86_64-randconfig-101-20250830 (https://download.01.org/0day-ci/archive/20250831/202508310743.euHihnAz-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.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/202508310743.euHihnAz-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 {
3cba19f6a00675 Josef Bacik 2025-08-26 1911 if (unlikely(!inode))
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1912 return;
3cba19f6a00675 Josef Bacik 2025-08-26 1913
0ae45f63d4ef8d Theodore Ts'o 2015-02-02 1914 retry:
3cba19f6a00675 Josef Bacik 2025-08-26 1915 lockdep_assert_not_held(&inode->i_lock);
3cba19f6a00675 Josef Bacik 2025-08-26 1916 VFS_BUG_ON_INODE(inode->i_state & I_CLEAR, inode);
3cba19f6a00675 Josef Bacik 2025-08-26 1917 /*
3cba19f6a00675 Josef Bacik 2025-08-26 1918 * Note this assert is technically racy as if the count is bogusly
3cba19f6a00675 Josef Bacik 2025-08-26 1919 * equal to one, then two CPUs racing to further drop it can both
3cba19f6a00675 Josef Bacik 2025-08-26 1920 * conclude it's fine.
3cba19f6a00675 Josef Bacik 2025-08-26 1921 */
3cba19f6a00675 Josef Bacik 2025-08-26 1922 VFS_BUG_ON_INODE(atomic_read(&inode->i_count) < 1, inode);
3cba19f6a00675 Josef Bacik 2025-08-26 1923
3cba19f6a00675 Josef Bacik 2025-08-26 @1924 if (atomic_add_unless(&inode->i_count, -1, 1))
3cba19f6a00675 Josef Bacik 2025-08-26 1925 return;
3cba19f6a00675 Josef Bacik 2025-08-26 1926
3cba19f6a00675 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 }
3cba19f6a00675 Josef Bacik 2025-08-26 1932
3cba19f6a00675 Josef Bacik 2025-08-26 1933 spin_lock(&inode->i_lock);
3cba19f6a00675 Josef Bacik 2025-08-26 1934 if (unlikely((inode->i_state & I_DIRTY_TIME) && inode->i_nlink)) {
3cba19f6a00675 Josef Bacik 2025-08-26 1935 spin_unlock(&inode->i_lock);
3cba19f6a00675 Josef Bacik 2025-08-26 1936 goto retry;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1937 }
3cba19f6a00675 Josef Bacik 2025-08-26 1938
3cba19f6a00675 Josef Bacik 2025-08-26 1939 if (!atomic_dec_and_test(&inode->i_count)) {
3cba19f6a00675 Josef Bacik 2025-08-26 1940 spin_unlock(&inode->i_lock);
3cba19f6a00675 Josef Bacik 2025-08-26 1941 return;
3cba19f6a00675 Josef Bacik 2025-08-26 1942 }
3cba19f6a00675 Josef Bacik 2025-08-26 1943
3cba19f6a00675 Josef Bacik 2025-08-26 1944 /*
3cba19f6a00675 Josef Bacik 2025-08-26 1945 * iput_final() drops ->i_lock, we can't assert on it as the inode may
3cba19f6a00675 Josef Bacik 2025-08-26 1946 * be deallocated by the time the call returns.
3cba19f6a00675 Josef Bacik 2025-08-26 1947 */
3cba19f6a00675 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-30 23:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-30 23:38 [brauner-github:vfs-6.18.inode.refcount.preliminaries 4/5] fs/inode.c:1924:45-46: WARNING: atomic_add_unless 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.