ceph: don't release i_ceph_lock in handle_cap_trunc

There's no reason to do this here. Just have the caller handle it.
Also, add a lockdep assertion.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Jeff Layton 2020-03-18 16:43:30 -04:00 committed by Ilya Dryomov
parent d7dbfb4f2b
commit 7391fba267

View File

@ -3631,10 +3631,9 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid,
* *
* caller hold s_mutex. * caller hold s_mutex.
*/ */
static void handle_cap_trunc(struct inode *inode, static bool handle_cap_trunc(struct inode *inode,
struct ceph_mds_caps *trunc, struct ceph_mds_caps *trunc,
struct ceph_mds_session *session) struct ceph_mds_session *session)
__releases(ci->i_ceph_lock)
{ {
struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_inode_info *ci = ceph_inode(inode);
int mds = session->s_mds; int mds = session->s_mds;
@ -3645,7 +3644,9 @@ static void handle_cap_trunc(struct inode *inode,
int implemented = 0; int implemented = 0;
int dirty = __ceph_caps_dirty(ci); int dirty = __ceph_caps_dirty(ci);
int issued = __ceph_caps_issued(ceph_inode(inode), &implemented); int issued = __ceph_caps_issued(ceph_inode(inode), &implemented);
int queue_trunc = 0; bool queue_trunc = false;
lockdep_assert_held(&ci->i_ceph_lock);
issued |= implemented | dirty; issued |= implemented | dirty;
@ -3653,10 +3654,7 @@ static void handle_cap_trunc(struct inode *inode,
inode, mds, seq, truncate_size, truncate_seq); inode, mds, seq, truncate_size, truncate_seq);
queue_trunc = ceph_fill_file_size(inode, issued, queue_trunc = ceph_fill_file_size(inode, issued,
truncate_seq, truncate_size, size); truncate_seq, truncate_size, size);
spin_unlock(&ci->i_ceph_lock); return queue_trunc;
if (queue_trunc)
ceph_queue_vmtruncate(inode);
} }
/* /*
@ -3905,6 +3903,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
size_t snaptrace_len; size_t snaptrace_len;
void *p, *end; void *p, *end;
struct cap_extra_info extra_info = {}; struct cap_extra_info extra_info = {};
bool queue_trunc;
dout("handle_caps from mds%d\n", session->s_mds); dout("handle_caps from mds%d\n", session->s_mds);
@ -4088,7 +4087,10 @@ void ceph_handle_caps(struct ceph_mds_session *session,
break; break;
case CEPH_CAP_OP_TRUNC: case CEPH_CAP_OP_TRUNC:
handle_cap_trunc(inode, h, session); queue_trunc = handle_cap_trunc(inode, h, session);
spin_unlock(&ci->i_ceph_lock);
if (queue_trunc)
ceph_queue_vmtruncate(inode);
break; break;
default: default: