Skip to content

Commit 3c30502

Browse files
jtlaytonidryomov
authored andcommitted
ceph: fix auth cap handling logic in remove_session_caps_cb
The existing logic relies on ci->i_auth_cap being NULL, but if we end up removing the auth cap early, then we'll do a lot of useless work and lock-taking on the remaining caps. Ensure that we only do the auth cap removal when we're _actually_ removing the auth cap. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent c35cac6 commit 3c30502

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ceph/mds_client.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1619,15 +1619,17 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap,
16191619
struct ceph_fs_client *fsc = (struct ceph_fs_client *)arg;
16201620
struct ceph_mds_client *mdsc = fsc->mdsc;
16211621
struct ceph_inode_info *ci = ceph_inode(inode);
1622+
bool is_auth;
16221623
bool dirty_dropped = false;
16231624
bool invalidate = false;
16241625
int capsnap_release = 0;
16251626

16261627
dout("removing cap %p, ci is %p, inode is %p\n",
16271628
cap, ci, &ci->vfs_inode);
16281629
spin_lock(&ci->i_ceph_lock);
1630+
is_auth = (cap == ci->i_auth_cap);
16291631
__ceph_remove_cap(cap, false);
1630-
if (!ci->i_auth_cap) {
1632+
if (is_auth) {
16311633
struct ceph_cap_flush *cf;
16321634

16331635
if (READ_ONCE(fsc->mount_state) >= CEPH_MOUNT_SHUTDOWN) {

0 commit comments

Comments
 (0)