* [PATCH V3] fs/ceph:fix double unlock in handle_cap_export()
@ 2020-04-30 6:12 Wu Bo
2020-04-30 7:55 ` Yan, Zheng
2020-04-30 12:08 ` Jeff Layton
0 siblings, 2 replies; 3+ messages in thread
From: Wu Bo @ 2020-04-30 6:12 UTC (permalink / raw)
To: jlayton, ukernel, sage, idryomov
Cc: ceph-devel, linux-kernel, liuzhiqiang26, linfeilong, wubo40
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V3] fs/ceph:fix double unlock in handle_cap_export()
2020-04-30 6:12 [PATCH V3] fs/ceph:fix double unlock in handle_cap_export() Wu Bo
@ 2020-04-30 7:55 ` Yan, Zheng
2020-04-30 12:08 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Yan, Zheng @ 2020-04-30 7:55 UTC (permalink / raw)
To: Wu Bo
Cc: Jeff Layton, Sage Weil, Ilya Dryomov, ceph-devel,
Linux Kernel Mailing List, liuzhiqiang26, linfeilong
On Thu, Apr 30, 2020 at 2:13 PM Wu Bo <wubo40@huawei.com> wrote:
>
> 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
>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V3] fs/ceph:fix double unlock in handle_cap_export()
2020-04-30 6:12 [PATCH V3] fs/ceph:fix double unlock in handle_cap_export() Wu Bo
2020-04-30 7:55 ` Yan, Zheng
@ 2020-04-30 12:08 ` Jeff Layton
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2020-04-30 12:08 UTC (permalink / raw)
To: Wu Bo, ukernel, sage, idryomov
Cc: ceph-devel, linux-kernel, liuzhiqiang26, linfeilong
On Thu, 2020-04-30 at 14:12 +0800, Wu Bo wrote:
> 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
>
For future reference, notes like this should go a little lower...
>
>
> Signed-off-by: Wu Bo <wubo40@huawei.com>
> ---
> fs/ceph/caps.c | 1 +
> 1 file changed, 1 insertion(+)
>
If you put the patch version notes here, they'll be stripped out when we
go to merge the patch with git-am.
> 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;
>
Looks good. Merged, but I did clean up the verbiage in the changelog a
bit.
Thanks!
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-30 12:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 6:12 [PATCH V3] fs/ceph:fix double unlock in handle_cap_export() Wu Bo
2020-04-30 7:55 ` Yan, Zheng
2020-04-30 12:08 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).