From: Xiubo Li Date: Thu, 20 Aug 2020 05:12:51 +0000 (-0400) Subject: client: switch to unique_lock to avoid use the client_lock directly X-Git-Tag: v17.0.0~1000^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=74c0890c69c541ea0b2a42b86a30c9aa84b66c30;p=ceph.git client: switch to unique_lock to avoid use the client_lock directly Fixes: https://tracker.ceph.com/issues/47039 Signed-off-by: Xiubo Li --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 0263aa78e666e..75e5594cdc07b 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -8416,7 +8416,7 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p, if (!mref_reader.is_state_satisfied()) return -ENOTCONN; - std::scoped_lock lock(client_lock); + std::unique_lock cl(client_lock); dir_result_t *dirp = static_cast(d); @@ -8453,9 +8453,9 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p, _ll_get(inode); } - client_lock.unlock(); + cl.unlock(); r = cb(p, &de, &stx, next_off, inode); - client_lock.lock(); + cl.lock(); if (r < 0) return r; @@ -8486,9 +8486,9 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p, _ll_get(inode); } - client_lock.unlock(); + cl.unlock(); r = cb(p, &de, &stx, next_off, inode); - client_lock.lock(); + cl.lock(); if (r < 0) return r; @@ -8553,9 +8553,9 @@ int Client::readdir_r_cb(dir_result_t *d, add_dirent_cb_t cb, void *p, _ll_get(inode); } - client_lock.unlock(); + cl.unlock(); r = cb(p, &de, &stx, next_off, inode); // _next_ offset - client_lock.lock(); + cl.lock(); ldout(cct, 15) << " de " << de.d_name << " off " << hex << next_off - 1 << dec << " = " << r << dendl;