blob: e8ffbfc10f4107c6c8b18f06e4ae7a5ef5778bf3 [file] [log] [blame]
From 81a79187ab70f12fd159e31805f0cd4615602f1f Mon Sep 17 00:00:00 2001
From: Wu Bo <wubo40@huawei.com>
Date: Thu, 30 Apr 2020 14:12:49 +0800
Subject: [PATCH] ceph: fix double unlock in handle_cap_export()
commit 4d8e28ff3106b093d98bfd2eceb9b430c70a8758 upstream.
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>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 886a6ad314f7..6ad4be1fd72e 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3665,6 +3665,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;
--
2.7.4