From patchwork Sat Feb 20 16:45:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 8367031 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C05E9F659 for ; Sat, 20 Feb 2016 16:46:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C622420501 for ; Sat, 20 Feb 2016 16:46:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7BD72050B for ; Sat, 20 Feb 2016 16:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757862AbcBTQqI (ORCPT ); Sat, 20 Feb 2016 11:46:08 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:35593 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757719AbcBTQpz (ORCPT ); Sat, 20 Feb 2016 11:45:55 -0500 Received: by mail-wm0-f49.google.com with SMTP id c200so116208266wme.0 for ; Sat, 20 Feb 2016 08:45:55 -0800 (PST) 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=EEPkkqPLV/grSnCg0phxs81fr2HzBb2kbSjUZ0osQZE=; b=Q+n8hmjKUE/pQL5OhdhVLQWaFZWCUmLMrpnSjsERp6CIX5UunxbMelMztbTxk3RhQu pFeqFbGJPj9TZU/0wseBh2AkVXaQelTs0Gae0jIjo55vLaNLZRYROXaw6ja5pgWBQn/Z FCTwhdjjcyN6KfGCcR9En+Z/o5iKflDuf2ybMsgxbwC4+b0WSiaOgp0uTOpTUOzYXK2t /Fj28x5ghzEqafsgURnF8iDGh17E74p6nAgMB6BaTgFxxWpz3aTNf0Ebee1KlqmkapC6 q/httYb+RjWxnFKqfGlXTP388sFPTQ7gUV4JZptwV6g8R+q4Vz5lEY4KXhK0uxE6Wzcj Mveg== 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=EEPkkqPLV/grSnCg0phxs81fr2HzBb2kbSjUZ0osQZE=; b=Vjr51Ev/z2P/G2ggvzRBD527qZo1TC6ep2rfFgVi/vFw4HAjfxF9VchauRpAev3C2r dpK++W1S1Ns3UMQw6J/dlnD+NU0uisgRji4qxPYY4oQmR+vwk1UnAKhg0eeJR9V6eovO uiglwTQXd4v2fLI34A+lX5UBkwOV7ihdHe6MMADTl0TUOPrlN2cTBugc/revppiRnoUt SbmYuk3XCaSMb3Uk52ZR5QrnlI2iaUS/M4AJqChwSIvq9lPSxHFqHueUnjjjDtdgTbW2 4BUdkawyIvTnIv0oPJHrDc7Gm9MG489nRv2xPiTawFWuw1L4rrgr/7F5yce5vuK8Ryav dgog== X-Gm-Message-State: AG10YORRHVM5FQ3dQbqFYwDpqAFjHiQKxXrBrfm16PNUYZZ9xr03QW4aIYfS7crCc/Yo2w== X-Received: by 10.195.13.16 with SMTP id eu16mr21377629wjd.140.1455986754823; Sat, 20 Feb 2016 08:45:54 -0800 (PST) Received: from dhcp-26-205.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id e19sm12784798wmd.1.2016.02.20.08.45.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Feb 2016 08:45:53 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Varada Kari Subject: [PATCH 1/4] libceph: don't bail early from try_read() when skipping a message Date: Sat, 20 Feb 2016 17:45:26 +0100 Message-Id: <1455986729-12544-2-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1455986729-12544-1-git-send-email-idryomov@gmail.com> References: <1455986729-12544-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-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The contract between try_read() and try_write() is that when called each processes as much data as possible. When instructed by osd_client to skip a message, try_read() is violating this contract by returning after receiving and discarding a single message instead of checking for more. try_write() then gets a chance to write out more requests, generating more replies/skips for try_read() to handle, forcing the messenger into a starvation loop. Cc: stable@vger.kernel.org # 3.10+ Reported-by: Varada Kari Signed-off-by: Ilya Dryomov Tested-by: Varada Kari Reviewed-by: Alex Elder --- net/ceph/messenger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 9cfedf565f5b..fec20819a5ea 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -2337,7 +2337,7 @@ static int read_partial_message(struct ceph_connection *con) con->in_base_pos = -front_len - middle_len - data_len - sizeof(m->footer); con->in_tag = CEPH_MSGR_TAG_READY; - return 0; + return 1; } else if ((s64)seq - (s64)con->in_seq > 1) { pr_err("read_partial_message bad seq %lld expected %lld\n", seq, con->in_seq + 1); @@ -2363,7 +2363,7 @@ static int read_partial_message(struct ceph_connection *con) sizeof(m->footer); con->in_tag = CEPH_MSGR_TAG_READY; con->in_seq++; - return 0; + return 1; } BUG_ON(!con->in_msg);