All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 2/6] libceph: don't call ->reencode_message() more than once per message
Date: Fri, 28 Jul 2017 14:41:26 +0200	[thread overview]
Message-ID: <1501245690-2362-3-git-send-email-idryomov@gmail.com> (raw)
In-Reply-To: <1501245690-2362-1-git-send-email-idryomov@gmail.com>

Reencoding an already reencoded message is a bad idea.  This could
happen on Policy::stateful_server connections (!CEPH_MSG_CONNECT_LOSSY),
such as MDS sessions.

This didn't pop up in testing because currently only OSD requests are
reencoded and OSD sessions are always lossy.

Fixes: 98ad5ebd1505 ("libceph: ceph_connection_operations::reencode_message() method")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 net/ceph/messenger.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index b7cc615d42ef..a67298c7e0cd 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1287,10 +1287,10 @@ static void prepare_write_message(struct ceph_connection *con)
 	if (m->needs_out_seq) {
 		m->hdr.seq = cpu_to_le64(++con->out_seq);
 		m->needs_out_seq = false;
-	}
 
-	if (con->ops->reencode_message)
-		con->ops->reencode_message(m);
+		if (con->ops->reencode_message)
+			con->ops->reencode_message(m);
+	}
 
 	dout("prepare_write_message %p seq %lld type %d len %d+%d+%zd\n",
 	     m, con->out_seq, le16_to_cpu(m->hdr.type),
-- 
2.4.3


  parent reply	other threads:[~2017-07-28 12:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 12:41 [PATCH 0/6] libceph: luminous semantic changes and fixes Ilya Dryomov
2017-07-28 12:41 ` [PATCH 1/6] libceph: make encode_request_*() work with r_mempool requests Ilya Dryomov
2017-07-31  1:55   ` Yan, Zheng
2017-07-28 12:41 ` Ilya Dryomov [this message]
2017-07-31  1:55   ` [PATCH 2/6] libceph: don't call ->reencode_message() more than once per message Yan, Zheng
2017-07-28 12:41 ` [PATCH 3/6] libceph: fallback for when there isn't a pool-specific choose_arg Ilya Dryomov
2017-07-28 12:41 ` [PATCH 4/6] crush: assume weight_set != null imples weight_set_size > 0 Ilya Dryomov
2017-07-28 12:41 ` [PATCH 5/6] libceph: upmap semantic changes Ilya Dryomov
2017-07-28 12:41 ` [PATCH 6/6] libceph: make RECOVERY_DELETES feature create a new interval Ilya Dryomov
2017-08-01 14:31 ` [PATCH 0/6] libceph: luminous semantic changes and fixes Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501245690-2362-3-git-send-email-idryomov@gmail.com \
    --to=idryomov@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.