ceph: fix double unlock in handle_cap_export()
authorWu Bo <wubo40@huawei.com>
Thu, 30 Apr 2020 06:12:49 +0000 (14:12 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 4 May 2020 17:14:23 +0000 (19:14 +0200)
If the ceph_mdsc_open_export_target_session() return fails, it will
do a "goto retry", but the session mutex has already been unlocked.
Re-lock the mutex in that case to ensure that we don't unlock it
twice.

Signed-off-by: Wu Bo <wubo40@huawei.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c

index 1a8e20ef35bf6fd15ef7e78fe2f8c8f1fa79f098..5f3aa4d607def2fd104a8c2349f37555cb53cfc3 100644 (file)
@@ -3746,6 +3746,7 @@ retry:
                WARN_ON(1);
                tsession = NULL;
                target = -1;
+               mutex_lock(&session->s_mutex);
        }
        goto retry;