Re: [PATCH] ceph: fix inode and i_filelock_ref leak on file lock rollback

From: Alex Markuze

Date: Sun Nov 22 2026 - 14:40:32 EST


Hi Daolong,

NACK. The rollback leak is real, but skipping fl_copy_lock() for every
unlock is not the right fix.

try_unlock_file() removes the local lock before the MDS unlock is sent.
The temporary i_filelock_ref keeps the auth cap from being trimmed during
that request. Without it, another cap can cover the bits the request is
using, and the auth cap can be released while the unlock is still in
flight. A second lock from the same client can then be granted without a
new auth cap. Processing that cap release removes every advisory lock the
client holds on the inode, including the new one. The new lock remains
installed locally, so another client can be granted a conflicting lock.

The guard in ceph_fl_copy_lock() already stops a second reference when the
request lock is attached. That covers the rollback. Please keep the
reference for an ordinary unlock.

Thanks,
Alex