@@ -318,6 +318,7 @@ struct rbd_obj_request {
enum img_req_flags {
IMG_REQ_CHILD, /* initiator: block = 0, child image = 1 */
IMG_REQ_LAYERED, /* ENOENT handling: normal = 0, layered = 1 */
+ IMG_REQ_NOLOCK, /* don't need exclusive lock and ->lock_rwsem */
};
enum rbd_img_state {
@@ -3550,6 +3551,9 @@ static bool need_exclusive_lock(struct rbd_img_request *img_req)
if (rbd_dev->spec->snap_id != CEPH_NOSNAP)
return false;
+ if (test_bit(IMG_REQ_NOLOCK, &img_req->flags))
+ return false;
+
rbd_assert(!test_bit(IMG_REQ_CHILD, &img_req->flags));
if (rbd_dev->opts->lock_on_read ||
(rbd_dev->header.features & RBD_FEATURE_OBJECT_MAP))
When we are going to replay an journal event, we don't need to acquire exclusive_lock, as we are in lock acquiring. Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn> --- drivers/block/rbd.c | 4 ++++ 1 file changed, 4 insertions(+)