From patchwork Sat Mar 9 16:36:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2241891 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 066AE3FCF6 for ; Sat, 9 Mar 2013 16:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760358Ab3CIQgw (ORCPT ); Sat, 9 Mar 2013 11:36:52 -0500 Received: from mail-ia0-f182.google.com ([209.85.210.182]:41114 "EHLO mail-ia0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758510Ab3CIQgv (ORCPT ); Sat, 9 Mar 2013 11:36:51 -0500 Received: by mail-ia0-f182.google.com with SMTP id b35so647060iac.27 for ; Sat, 09 Mar 2013 08:36:51 -0800 (PST) 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=YX1gE05ta0I5o0cdrILAutnrmO43dA4WR+B74QE6Lnk=; b=SR/82moqDgsMlLpgbmFd1/3T3jdZnr4Jjl1LQJGZsFK8e5yUBpuEqYqZQ3LObBqRT8 HHEUpEeXwdcb9p9MOVanEU+rNNe83p94kAJBt3fHl5JJXk6u+aGtTCVxpxgnNe7X44xF V2GjEQSJCJzJbHDU8FWixKTUtjzESkyHh2cXtJSon8O0689h+zi+sP3WfbBEkByl4c07 LRhseKZbfgoUnkTFxgLq/Yl1TnFWvP/y8clWTrH2P1VeNORDVQZIOAifCUhUaUPIjrEL sxIpoLZo6qXI7o1cd3n/uvyGC0bBSalgNlc9KaqCcOSp/PQXw91/oTJD5Rtis7NP5IX5 +oOQ== X-Received: by 10.50.150.228 with SMTP id ul4mr1947439igb.9.1362847010950; Sat, 09 Mar 2013 08:36:50 -0800 (PST) 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 ip2sm4400028igc.5.2013.03.09.08.36.49 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 08:36:49 -0800 (PST) Message-ID: <513B6520.8050303@inktank.com> Date: Sat, 09 Mar 2013 10:36:48 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH] libceph: don't clear bio_iter in prepare_write_message() X-Gm-Message-State: ALoCoQlFfIwhGbMZFeF0nKFioioYH9N+0at9dewXogdBMRMASSJ5xFw4vAM2p+4xZahH/MOI3bZH Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org This patch is available in the branch "review/wip-msgr-refactor" (prior to 6 other patches) in the ceph-client git repository. That branch is based on branch "review/wip-abstract-2". -Alex At one time it was necessary to clear a message's bio_iter field to avoid a bad pointer dereference in write_partial_msg_pages(). That no longer seems to be the case. Here's why. The message's bio fields represent (in this case) outgoing data. Between where the bio_iter is made NULL in prepare_write_message() and the call in that function to prepare_message_data(), the bio fields are never used. In prepare_message_data(), init-bio_iter() is called, and the result of that overwrites the value in the message's bio_iter field. Because it gets overwritten anyway, there is no need to set it to NULL. So don't do it. This resolves: http://tracker.ceph.com/issues/4402 Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- net/ceph/messenger.c | 4 ---- 1 file changed, 4 deletions(-) m, con->out_seq, le16_to_cpu(m->hdr.type), diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index e75a03d..17d9321 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -804,10 +804,6 @@ static void prepare_write_message(struct ceph_connection *con) m->hdr.seq = cpu_to_le64(++con->out_seq); m->needs_out_seq = false; } -#ifdef CONFIG_BLOCK - else - m->bio_iter = NULL; -#endif dout("prepare_write_message %p seq %lld type %d len %d+%d+%d (%zd)\n",