Commit 7391fba2 authored by Jeff Layton's avatar Jeff Layton Committed by Ilya Dryomov

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: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent d7dbfb4f
......@@ -3631,10 +3631,9 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid,
*
* 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_session *session)
__releases(ci->i_ceph_lock)
{
struct ceph_inode_info *ci = ceph_inode(inode);
int mds = session->s_mds;
......@@ -3645,7 +3644,9 @@ static void handle_cap_trunc(struct inode *inode,
int implemented = 0;
int dirty = __ceph_caps_dirty(ci);
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;
......@@ -3653,10 +3654,7 @@ static void handle_cap_trunc(struct inode *inode,
inode, mds, seq, truncate_size, truncate_seq);
queue_trunc = ceph_fill_file_size(inode, issued,
truncate_seq, truncate_size, size);
spin_unlock(&ci->i_ceph_lock);
if (queue_trunc)
ceph_queue_vmtruncate(inode);
return queue_trunc;
}
/*
......@@ -3905,6 +3903,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
size_t snaptrace_len;
void *p, *end;
struct cap_extra_info extra_info = {};
bool queue_trunc;
dout("handle_caps from mds%d\n", session->s_mds);
......@@ -4088,7 +4087,10 @@ void ceph_handle_caps(struct ceph_mds_session *session,
break;
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;
default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment