From patchwork Thu Sep 18 10:45:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreedhar Kodali X-Patchwork-Id: 4930401 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 478279F2EC for ; Thu, 18 Sep 2014 10:45:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E44F82010B for ; Thu, 18 Sep 2014 10:46:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C319C200FF for ; Thu, 18 Sep 2014 10:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755987AbaIRKqD (ORCPT ); Thu, 18 Sep 2014 06:46:03 -0400 Received: from e35.co.us.ibm.com ([32.97.110.153]:53679 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755755AbaIRKqC (ORCPT ); Thu, 18 Sep 2014 06:46:02 -0400 Received: from /spool/local by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Sep 2014 04:46:01 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 18 Sep 2014 04:45:59 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id F0E691FF001D for ; Thu, 18 Sep 2014 04:45:57 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8IAi127065986 for ; Thu, 18 Sep 2014 12:44:01 +0200 Received: from d03av01.boulder.ibm.com (localhost [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s8IAjwx0003066 for ; Thu, 18 Sep 2014 04:45:59 -0600 Received: from ltcweb.rtp.raleigh.ibm.com (ltcweb.rtp.raleigh.ibm.com [9.37.210.204]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s8IAjwDE003043; Thu, 18 Sep 2014 04:45:58 -0600 Received: from ltc.linux.ibm.com (localhost.localdomain [127.0.0.1]) by ltcweb.rtp.raleigh.ibm.com (Postfix) with ESMTP id 4B7FDC0103; Thu, 18 Sep 2014 06:45:58 -0400 (EDT) MIME-Version: 1.0 Date: Thu, 18 Sep 2014 16:15:58 +0530 From: Sreedhar Kodali To: sean.hefty@intel.com Cc: linux-rdma@vger.kernel.org, pradeeps@linux.vnet.ibm.com Subject: [PATCH v5 3/4] rsockets: fix rsocket state when interrupted waiting for events Message-ID: <3429fa019ebfb4a49bf1e670da8ae4fe@imap.linux.ibm.com> X-Sender: srkodali@linux.vnet.ibm.com User-Agent: Roundcube Webmail/1.0.1 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14091810-6688-0000-0000-000004E811D3 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable 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 Note: This patch is reworked based on suggestions from Sean and Jason Also attached the patch file for convenience From: Sreedhar Kodali Date: Thu Sep 18 14:35:42 2014 +0530 While waiting for a completion event, rsocket state is incorrectly set to error when interrupted. Instead, the caller of get completion event should decide what to do with it based on errno. The fix is do not change the state to rs_error when errno is EINTR inside get completion event. Signed-off-by: Sreedhar Kodali Reviewed-by: Pradeep Satyanarayana --- commit 3cd51b727b58f2e3aa03d77e9c410a5488a09112 Author: Sreedhar Kodali Date: Thu Sep 18 14:35:42 2014 +0530 While waiting for a completion event, rsocket state is incorrectly set to error when interrupted. Instead, the caller of get completion event should decide what to do with it based on errno. The fix is do not change the state to rs_error when errno is EINTR inside get completion event. Signed-off-by: Sreedhar Kodali Reviewed-by: Pradeep Satyanarayana --- diff --git a/src/rsocket.c b/src/rsocket.c index 39c35cf..16792cf 100644 --- a/src/rsocket.c +++ b/src/rsocket.c @@ -1976,7 +1976,7 @@ static int rs_get_cq_event(struct rsocket *rs) rs->unack_cqe = 0; } rs->cq_armed = 0; - } else if (errno != EAGAIN) { + } else if (!(errno == EAGAIN || errno == EINTR)) { rs->state = rs_error; } diff --git a/src/rsocket.c b/src/rsocket.c index 39c35cf..16792cf 100644 --- a/src/rsocket.c +++ b/src/rsocket.c @@ -1976,7 +1976,7 @@ static int rs_get_cq_event(struct rsocket *rs) rs->unack_cqe = 0; } rs->cq_armed = 0; - } else if (errno != EAGAIN) { + } else if (!(errno == EAGAIN || errno == EINTR)) { rs->state = rs_error; }