[PATCH v4 2/2] ceph: fix potential use-after-free bug when trimming caps