Add ceph_assert(dn->ref > 0) after Dentry::unlink() in Client::unlink()
to catch the case where internal put() calls drop the dentry reference
to zero before we proceed to detach/lru_remove.
This turns a silent use-after-free into a clean assertion failure with
a full stack trace, making it possible to catch the exact conditions
in a test environment.
Signed-off-by: Igor Golikov <igolikov@ibm.com>
Fixes: https://tracker.ceph.com/issues/74625
dec_dentry_nr();
ldout(cct, 20) << "unlink inode " << in << " parents now " << in->dentries << dendl;
}
+ ceph_assert(dn->ref > 0);
if (keepdentry) {
dn->lease_mds = -1;