From: Wu Bo <wubo40@huawei.com>
To: <jlayton@kernel.org>, <ukernel@gmail.com>, <sage@redhat.com>,
<idryomov@gmail.com>
Cc: <ceph-devel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<liuzhiqiang26@huawei.com>, <linfeilong@huawei.com>,
<wubo40@huawei.com>
Subject: [PATCH V3] fs/ceph:fix double unlock in handle_cap_export()
Date: Thu, 30 Apr 2020 14:12:49 +0800 [thread overview]
Message-ID: <1588227169-83237-1-git-send-email-wubo40@huawei.com> (raw)
If the ceph_mdsc_open_export_target_session() return fails,
we should add mutex_lock(&session->s_mutex) on IS_ERR(tsession) block
to avoid twice unlocking. because the session->s_mutex will be unlock
at the out_unlock lable.
--
v2 -> v3:
- Rewrite solution, adding a mutex_lock(&session->s_mutex)
to the IS_ERR(tsession) block.
- Modify the comment more clearly.
v1 -> v2:
- add spin_lock(&ci->i_ceph_lock) before goto out_unlock lable
Signed-off-by: Wu Bo <wubo40@huawei.com>
---
fs/ceph/caps.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 185db76..d27d778 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3746,6 +3746,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
WARN_ON(1);
tsession = NULL;
target = -1;
+ mutex_lock(&session->s_mutex);
}
goto retry;
--
1.8.3.1
next reply other threads:[~2020-04-30 6:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 6:12 Wu Bo [this message]
2020-04-30 7:55 ` Yan, Zheng
2020-04-30 12:08 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1588227169-83237-1-git-send-email-wubo40@huawei.com \
--to=wubo40@huawei.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jlayton@kernel.org \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuzhiqiang26@huawei.com \
--cc=sage@redhat.com \
--cc=ukernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®