From patchwork Thu Jun 25 16:56:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Canet?= X-Patchwork-Id: 6676691 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 755BEC05AC for ; Thu, 25 Jun 2015 16:56:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93DD6206F7 for ; Thu, 25 Jun 2015 16:56:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CEB9206EF for ; Thu, 25 Jun 2015 16:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752360AbbFYQ41 (ORCPT ); Thu, 25 Jun 2015 12:56:27 -0400 Received: from 28-113-190-109.dsl.ovh.fr ([109.190.113.28]:33453 "EHLO ariel" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752076AbbFYQ41 (ORCPT ); Thu, 25 Jun 2015 12:56:27 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) by ariel (Postfix) with ESMTP id 6E7FDAC013C; Thu, 25 Jun 2015 18:56:28 +0200 (CEST) From: =?UTF-8?q?Beno=C3=AEt=20Canet?= To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, elder@ieee.org, =?UTF-8?q?Beno=C3=AEt=20Canet?= Subject: [PATCH] libceph: Fix ceph_tcp_sendpage()'s more boolean usage Date: Thu, 25 Jun 2015 18:56:26 +0200 Message-Id: <1435251386-25108-1-git-send-email-benoit.canet@nodalink.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Spotted while hunting http://tracker.ceph.com/issues/10905. From struct ceph_msg_data_cursor in include/linux/ceph/messenger.h: bool last_piece; /* current is last piece */ In ceph_msg_data_next(): *last_piece = cursor->last_piece; A call to ceph_msg_data_next() is followed by: ret = ceph_tcp_sendpage(con->sock, page, page_offset, length, last_piece); while ceph_tcp_sendpage() is: static int ceph_tcp_sendpage(struct socket *sock, struct page *page,i int offset, size_t size, bool more) The logic is inverted: correct it. Signed-off-by: BenoƮt Canet Reviewed-by: Alex Elder --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index ec68cd3..eda06fd 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1544,7 +1544,7 @@ static int write_partial_message_data(struct ceph_connection *con) page = ceph_msg_data_next(&msg->cursor, &page_offset, &length, &last_piece); ret = ceph_tcp_sendpage(con->sock, page, page_offset, - length, last_piece); + length, !last_piece); if (ret <= 0) { if (do_datacrc) msg->footer.data_crc = cpu_to_le32(crc);