fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383.
From: kernel test robot
Date: Mon Jun 01 2026 - 22:15:11 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e43ffb69e0438cddd72aaa30898b4dc446f664f8
commit: 4882ba78574e2d8c579658f65f6784b0d139d173 afs: Fix afs_server ref accounting
date: 1 year, 3 months ago
config: hexagon-randconfig-r064-20260601 (https://download.01.org/0day-ci/archive/20260602/202606021010.6QMyYfim-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
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
| Fixes: 4882ba78574e ("afs: Fix afs_server ref accounting")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606021010.6QMyYfim-lkp@xxxxxxxxx/
cocci warnings: (new ones prefixed by >>)
>> fs/afs/server.c:375:5-24: WARNING: atomic_dec_and_test variation before object free at line 383.
fs/afs/server.c:357:5-24: WARNING: atomic_dec_and_test variation before object free at line 360.
vim +375 fs/afs/server.c
365
366 /*
367 * Drop an active count on a server object.
368 */
369 void afs_unuse_server(struct afs_net *net, struct afs_server *server,
370 enum afs_server_trace reason)
371 {
372 if (!server)
373 return;
374
> 375 if (atomic_dec_and_test(&server->active)) {
376 if (!test_bit(AFS_SERVER_FL_EXPIRED, &server->flags) &&
377 READ_ONCE(server->cell->state) < AFS_CELL_FAILED) {
378 time64_t unuse_time = ktime_get_real_seconds();
379
380 server->unuse_time = unuse_time;
381 afs_set_server_timer(server, afs_server_gc_delay);
382 } else {
> 383 schedule_work(&server->destroyer);
384 }
385 }
386
387 afs_put_server(net, server, reason);
388 }
389
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki