]> git.ipfire.org Git - thirdparty/linux.git/commit
ceph: fix writeback_count leak in write_folio_nounlock()
authorWentao Liang <vulab@iscas.ac.cn>
Thu, 4 Jun 2026 02:19:51 +0000 (02:19 +0000)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 23 Jul 2026 18:29:41 +0000 (20:29 +0200)
commitcbf59617cd715219e84c50d106a3d0e1e8ba054e
tree2375cb25532725085903e18c22aa3e3f2786960d
parenta109a556115271ca7896dcda7b4b7e45e156c227
ceph: fix writeback_count leak in write_folio_nounlock()

write_folio_nounlock() increments fsc->writeback_count to track
in-flight writeback operations. On several error paths where the
function returns early (folio lookup failure, snapshot context
allocation failure, and writepages submission failure), the function
returns without calling atomic_long_dec_return() to decrement the
counter.

Each leaked increment keeps the counter above zero, which can prevent
the filesystem from cleanly unmounting or suspending writes.

Add atomic_long_dec_return() calls on all error paths that currently
return without decrementing the counter.

Cc: stable@vger.kernel.org
Fixes: d55207717ded ("ceph: add encryption support to writepage and writepages")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/addr.c