From patchwork Mon Sep 19 17:03:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9339929 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4E46560B16 for ; Mon, 19 Sep 2016 17:04:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B3AC295C9 for ; Mon, 19 Sep 2016 17:04:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F991295D8; Mon, 19 Sep 2016 17:04:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5756295D4 for ; Mon, 19 Sep 2016 17:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752636AbcISREB (ORCPT ); Mon, 19 Sep 2016 13:04:01 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:34470 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752502AbcISRDv (ORCPT ); Mon, 19 Sep 2016 13:03:51 -0400 Received: by mail-yw0-f195.google.com with SMTP id t67so8397755ywg.1 for ; Mon, 19 Sep 2016 10:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HWSQFRUjuP96BAWHgyk0p41ZQDfqr0iIEO1rKSHIzD8=; b=Alqpc07bAoEaMCp2eq90FOvx9cdgcPn0NIn5QHBXEw8XlzxqAeN34B2Nb9jZY8xRuT a1SmresaLWD2v/cfpN9LXcnEjxj7QrYtyUayQxQmbpIxboJGIrE1Inu4T4WVYQlP35Z9 l5wUNEsG3LcJepNnWFH96EDJtYTjCEoHCjmXDh3PHbfjfAw4YAJKCLyGgqfIJovJqBL7 O78vKWczW4MZ/9OUdNXWMK0bZn9N1D+9sX3wC+ZYOXRbgModVf1oSTzKPXBlbXyoNFMF N2O52wIJFuIDlY72scNGRZbNAkGO3VccW2Yp3fPLKm9Sx76VuCVcBtNx6TFP+RBt5lK2 uuSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HWSQFRUjuP96BAWHgyk0p41ZQDfqr0iIEO1rKSHIzD8=; b=SfZOem18LRmzu6ItRuV/3Wq3qjs7WOd+FeJ75U1geyjH5HiYfvV7b+ZjINlmok8Mg/ WXADylDImw+1a/1NrtQCfWQkzLnOj/hHG9u6ev8Q4u/ZHbAdvgwY7tdh5hOY5CrfWNQx AuUDosodZNNERaMwxLkbeXkORteA2VZW9yXtc6Blf96mHthrFqfWoLJvrCGxkiMkbCBa ya6E9HJkXyBESjNbb+YCkmZtWN/FaYZkeXTpf3JRs5xJTyKZ2HGv9H3yBr2GNPqgrxXB g3kXpC5+ijCyhoflGoun5nxAga9uhyFHIbun9cfXh0kX6VwIMRJ7oAYQ412rNqTZ8AQw agQg== X-Gm-Message-State: AE9vXwPwEDCnqxMlMRjhwrKFjNEReFwD6FhhcPVyxCEjw7Y7fZTwhWVjm435L8DFR1oZTg== X-Received: by 10.13.232.150 with SMTP id r144mr19416068ywe.353.1474304630602; Mon, 19 Sep 2016 10:03:50 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o14sm9773905ywd.3.2016.09.19.10.03.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Sep 2016 10:03:50 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Alex Elder Subject: [PATCH 7/8] rbd: don't call rbd_osd_req_format_read() for !img_data requests Date: Mon, 19 Sep 2016 19:03:27 +0200 Message-Id: <1474304608-17958-8-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1474304608-17958-1-git-send-email-idryomov@gmail.com> References: <1474304608-17958-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Accessing obj_request->img_request union field is only valid for object requests associated with an image (i.e. if obj_request_img_data_test() returns true). rbd_osd_req_format_read() used to do more, but now it just sets osd_req->snap_id. Standalone and stat object requests always go to the HEAD revision and are fine with CEPH_NOSNAP set by libceph, so get around the invalid union field use by simply not calling rbd_osd_req_format_read() in those places. Reported-by: David Disseldorp Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder Reviewed-by: David Disseldorp --- drivers/block/rbd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 03f171067e08..8907ee6342ac 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1943,11 +1943,10 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req) static void rbd_osd_req_format_read(struct rbd_obj_request *obj_request) { - struct rbd_img_request *img_request = obj_request->img_request; struct ceph_osd_request *osd_req = obj_request->osd_req; - if (img_request) - osd_req->r_snapid = img_request->snap_id; + rbd_assert(obj_request_img_data_test(obj_request)); + osd_req->r_snapid = obj_request->img_request->snap_id; } static void rbd_osd_req_format_write(struct rbd_obj_request *obj_request) @@ -2929,8 +2928,6 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) stat_request->page_count = page_count; stat_request->callback = rbd_img_obj_exists_callback; - rbd_osd_req_format_read(stat_request); - rbd_obj_request_submit(stat_request); return 0; @@ -4026,7 +4023,6 @@ static int rbd_obj_method_sync(struct rbd_device *rbd_dev, osd_req_op_cls_response_data_pages(obj_request->osd_req, 0, obj_request->pages, inbound_size, 0, false, false); - rbd_osd_req_format_read(obj_request); rbd_obj_request_submit(obj_request); ret = rbd_obj_request_wait(obj_request); @@ -4265,7 +4261,6 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, obj_request->length, obj_request->offset & ~PAGE_MASK, false, false); - rbd_osd_req_format_read(obj_request); rbd_obj_request_submit(obj_request); ret = rbd_obj_request_wait(obj_request);