From patchwork Sun Oct 28 13:38:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 989985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-96782-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="onVvOGs/"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42jf2Y0gkXz9sDF for ; Mon, 29 Oct 2018 00:38:44 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=bMFIsl3GN6XW0tWB1Zja8BIZjhg99LSHZRVsmZQUdSnRqM+2lJuJo yqyUkjpLbC/9TRhpaK/CsFMRnvD1Rgiot2NTV8pMkkTgR90eyPQqT8QhMDvJWo72 rAVVqZPwhrJa/N/QOOyWYkJIowgtLZb+KHvG47yelY1F6pFUnq0vSM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=8tEYrZHIWAvLKTm8dq3eV65KS6s=; b=onVvOGs/woDkNZPrNFIsLDH6xtfg J/t4aUXxkXPgM2kNU/9SA/ciJ/6Zdulo4NUqYdaT+DM5UWvKvpqZMOAv71hClUzK UYSg+gnVWGiH/aAjdtFCaHdPzPWEDPdc++A4Gz2vk7+4NTI7eANQpq/bO4b2P5FI jqMsY44ENv56jto= Received: (qmail 63801 invoked by alias); 28 Oct 2018 13:38:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63739 invoked by uid 89); 28 Oct 2018 13:38:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=cancel, 60000, respond, HContent-Transfer-Encoding:8bit X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd, commited 2/3] hurd: Return EIO on non-responding interrupted servers Date: Sun, 28 Oct 2018 14:38:19 +0100 Message-Id: <20181028133820.11856-3-samuel.thibault@ens-lyon.org> In-Reply-To: <20181028133820.11856-1-samuel.thibault@ens-lyon.org> References: <20181028133820.11856-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 since we do not actually know whether the RPC was completed or not, which makes a huge difference for e.g. write(), so better really error out than letting caller think that the RPC did not happen. * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not answer to interrupt_operation, return EIO instead of EINTR. --- ChangeLog | 2 ++ hurd/intr-msg.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79255d3795..7d23aa7236 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2018-10-28 Samuel Thibault * hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): Set to 60000. + * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg): When the server does not + answer to interrupt_operation, return EIO instead of EINTR. 2018-10-26 Joseph Myers diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 2f83ac6ce7..1f7724ee8b 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -141,7 +141,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, else /* The operation was supposedly interrupted, but still has not returned. Declare it interrupted. */ - goto interrupted; + goto dead; case MACH_SEND_INTERRUPTED: /* RPC didn't get out. */ if (!(option & MACH_SEND_MSG)) @@ -324,17 +324,21 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, timeout = user_timeout; goto message; } - /* FALLTHROUGH */ + err = EINTR; + + /* The EINTR return indicates cancellation, so clear the flag. */ + ss->cancel = 0; + break; case MACH_RCV_PORT_DIED: /* Server didn't respond to interrupt_operation, so the signal thread destroyed the reply port. */ /* FALLTHROUGH */ - interrupted: - err = EINTR; + dead: + err = EIO; - /* The EINTR return indicates cancellation, so clear the flag. */ + /* The EIO return indicates cancellation, so clear the flag. */ ss->cancel = 0; break;