mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
ceph: don't leak snap_rwsem in handle_cap_grant
commit58dd438557upstream. When handle_cap_grant is called on an IMPORT op, then the snap_rwsem is held and the function is expected to release it before returning. It currently fails to do that in all cases which could lead to a deadlock. Fixes:6f05b30ea0("ceph: reset i_requested_max_size if file write is not wanted") Link: https://tracker.ceph.com/issues/55857 Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Luís Henriques <lhenriques@suse.de> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
eea0d84a4f
commit
aee18421bd
|
|
@ -3501,8 +3501,8 @@ static void handle_cap_grant(struct inode *inode,
|
||||||
fill_inline = true;
|
fill_inline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci->i_auth_cap == cap &&
|
if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT) {
|
||||||
le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT) {
|
if (ci->i_auth_cap == cap) {
|
||||||
if (newcaps & ~extra_info->issued)
|
if (newcaps & ~extra_info->issued)
|
||||||
wake = true;
|
wake = true;
|
||||||
|
|
||||||
|
|
@ -3514,11 +3514,10 @@ static void handle_cap_grant(struct inode *inode,
|
||||||
}
|
}
|
||||||
|
|
||||||
ceph_kick_flushing_inode_caps(session, ci);
|
ceph_kick_flushing_inode_caps(session, ci);
|
||||||
spin_unlock(&ci->i_ceph_lock);
|
|
||||||
up_read(&session->s_mdsc->snap_rwsem);
|
|
||||||
} else {
|
|
||||||
spin_unlock(&ci->i_ceph_lock);
|
|
||||||
}
|
}
|
||||||
|
up_read(&session->s_mdsc->snap_rwsem);
|
||||||
|
}
|
||||||
|
spin_unlock(&ci->i_ceph_lock);
|
||||||
|
|
||||||
if (fill_inline)
|
if (fill_inline)
|
||||||
ceph_fill_inline_data(inode, NULL, extra_info->inline_data,
|
ceph_fill_inline_data(inode, NULL, extra_info->inline_data,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user