From patchwork Sun Apr 21 21:55:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2469631 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D1588DF230 for ; Sun, 21 Apr 2013 21:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752979Ab3DUVz6 (ORCPT ); Sun, 21 Apr 2013 17:55:58 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:63006 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752132Ab3DUVz5 (ORCPT ); Sun, 21 Apr 2013 17:55:57 -0400 Received: by mail-ie0-f177.google.com with SMTP id 9so6426672iec.22 for ; Sun, 21 Apr 2013 14:55:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=1/fSirOrRWxbjToI9Z6mMuL0TbYK+BXKn9WAfsCPTo8=; b=gMzRRxVp8Yy/UmrJFrh4uZScpDkFvL7XNEz+0gWyEpeasV5GB7DIp9qKD1pZlmWE4C i4yBRNOs+yB890tstuptlBNe5zbeXH3fAwdw0ehfNyvH4McXZDMZ3kjFFkRnAGaC5a5H qlvISoF7NDUGCVLz9McIQZRZEeF/aNoahMKVhJIA5lJZeKGnfplehxJxmjbck6OgY8B6 d7JN72o3ZBw4d0p+MDXsoyRHlzyzLUe8OTQ4yHF+9dGVs4mPhcJDHBlmDiLy8s86gel+ WYFrgT1GdM7Sb4LiB1XSO9QaGeVbBsX9BlnDQwcnFnoX2BM09h/+I5wE/UtkBBpdHe8s bp2A== X-Received: by 10.50.136.167 with SMTP id qb7mr6760849igb.98.1366581357346; Sun, 21 Apr 2013 14:55:57 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id fl5sm12674408igb.9.2013.04.21.14.55.55 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 21 Apr 2013 14:55:56 -0700 (PDT) Message-ID: <5174606B.4090906@inktank.com> Date: Sun, 21 Apr 2013 16:55:55 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH] libceph: fix byte order mismatch X-Gm-Message-State: ALoCoQlJA2vQE5i5aFEiqjhSdoymvtGsKPtYzEsvW0Boui/alaYzB3outDELjDl2hVSuCU2cLbOA Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org A WATCH op includes an object version. The version that's supplied is incorrectly byte-swapped osd_req_op_watch_init() where it's first assigned (it's been this way since that code was first added). The result is that the version sent to the osd is wrong, because that value gets byte-swapped again in osd_req_encode_op(). This is the source of a sparse warning related to improper byte order in the assignment. The approach of using the version to avoid a race is deprecated (see http://tracker.ceph.com/issues/3871), and the watch parameter is no longer even examined by the osd. So fix the assignment in osd_req_op_watch_init() so it no longer does the byte swap. This resolves: http://tracker.ceph.com/issues/3847 Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- net/ceph/osd_client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) } diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 467020c..57d8db5 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -577,8 +577,7 @@ void osd_req_op_watch_init(struct ceph_osd_request *osd_req, BUG_ON(opcode != CEPH_OSD_OP_NOTIFY_ACK && opcode != CEPH_OSD_OP_WATCH); op->watch.cookie = cookie; - /* op->watch.ver = version; */ /* XXX 3847 */ - op->watch.ver = cpu_to_le64(version); + op->watch.ver = version; if (opcode == CEPH_OSD_OP_WATCH && flag) op->watch.flag = (u8)1;