From patchwork Sun Dec 3 00:23:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keno Fischer X-Patchwork-Id: 10089083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCF71600C5 for ; Sun, 3 Dec 2017 00:24:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE9862941D for ; Sun, 3 Dec 2017 00:24:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2E7B29442; Sun, 3 Dec 2017 00:24:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3A82941D for ; Sun, 3 Dec 2017 00:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752488AbdLCAYG (ORCPT ); Sat, 2 Dec 2017 19:24:06 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:36926 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751533AbdLCAYF (ORCPT ); Sat, 2 Dec 2017 19:24:05 -0500 Received: by mail-qt0-f194.google.com with SMTP id d15so17334578qte.4 for ; Sat, 02 Dec 2017 16:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=juliacomputing-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=eKepc+IlpQHgKEyHwGj71QdxRf7AWQttlDxGLeFILgU=; b=eGyTiy4AKOwFHxBy7jLfAgReJrbVeflygm6eWseSCNFl/4MlZ0Xo2Ap0usWNm/EHfx lKQfoGb0VOl3Y4Q/HvRWS7954rn0QFQ8zcE58fElW/T0g4/uu73DKXinIMUg/JgyI5k/ NBiJCoQ85tvC89oHbkTp/PDW9bYrfDNhkPe6f3uejGoduwJAD+1bv76hd3pOlGUTvzCB Nda8hVKSkmVK/07ppdhAsaECGILqxKlgagDLOs0NUNi2oJ+oDw7uhZ2A5XtKDb8oNXLM 80ZvFkg0xizLjGeizkLhtu2SiW+GzOqzUSTL+GB7GUf4qzHTE1Wn04YPoKyxIUO9if+0 eBhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=eKepc+IlpQHgKEyHwGj71QdxRf7AWQttlDxGLeFILgU=; b=fzgyGOE2/bV2XbWUBLI69U5sFByBXxIskq9gjVsH3Zp6da9bO9h2NrNSXr6F3v8WCN boXD9TcMhcGiD0bSym6eCFYhz/ehWWd3HSlMGUuBUDrooLMWnFDIPV/iZW2eUE4VuIGx CSKAK/Q9lj/uMWucFP5fUFFo34Tow3SzXSAaKjeRd2qFlzY19yQbASuKMd9dRflQZ8RA Ik1Yv3aZP/zVJ0CncLmlMxxQ3Ud1eOADSEaGyyCudALN2Sgv5prLTeFMyh+2Nkqnbkuv //7pwTY2UmEy17sTuYxKMi7ydIl+jfoqr69QNRdtAHx7EhysZSczUAsTTHU+KLddPLC4 qj/w== X-Gm-Message-State: AKGB3mLIUUZk2PpZMvx4PDSGKLeZuCPbF0fhHsZr4XybiNiMlIz9LiV8 osoEcQMWwbJMGHS39Q+5MteSJQ== X-Google-Smtp-Source: AGs4zMZOis82vyQzjgI6Xiv3/1TjNDVjfaNBHgLmiDVZcPsZjugptyNXMXMVG3mYhYoYsn37T696rA== X-Received: by 10.200.35.215 with SMTP id r23mr14431144qtr.174.1512260644063; Sat, 02 Dec 2017 16:24:04 -0800 (PST) Received: from juliacomputing.com ([2601:184:407f:f1b8:4db1:7696:c4ad:df04]) by smtp.gmail.com with ESMTPSA id p8sm7103490qtj.70.2017.12.02.16.24.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Dec 2017 16:24:02 -0800 (PST) Date: Sat, 2 Dec 2017 19:23:59 -0500 From: Keno Fischer To: linux-man@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, mtk.manpages@gmail.com, tuomas@tuxera.com Subject: [PATCH RFC] stat.2: Document that stat can fail with EINTR Message-ID: <20171203002359.GA17037@juliacomputing.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Particularly on network file systems, a stat call may require submitting a message over the network and waiting interruptably for a reply. Signed-off-by: Keno Fischer --- The catalyst for this patch was me experiencing EINTR errors when using the 9p file system. In linux commit 9523feac, the 9p file system was changed to use wait_event_killable instead of wait_event_interruptible, which does indeed address my problem, but also makes me a bit unhappy, because uninterruptable waits prevents things like ^C'ing the execution and some debugging tools which depend on being able to cancel long-running operations by sending signals. I'd like to ask the user space applications I care about to properly handle such situations (either by using SA_RESTART or by explicitly handling EINTR), but it's a bit of a hard sell if EINTR isn't documented to be a possibility. I'm hoping this doc PATCH will generate a discussion of whether EINTR is an appropriate thing for stat (as a stand in for a file system call that's not read/write) to return. If so, I'd be happy to submit patches to other file system-related syscalls along these same lines. I realize I'm probably 20 years too late here, but it feels like clarificaion on what to expect from the kernel would still go a long way here. man2/stat.2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/man2/stat.2 b/man2/stat.2 index dad9a01..f10235a 100644 --- a/man2/stat.2 +++ b/man2/stat.2 @@ -452,6 +452,11 @@ Invalid flag specified in is relative and .I dirfd is a file descriptor referring to a file other than a directory. +.TP +.B EINTR +The call was interrupted by delivery of a signal caught by a handler; see +.BR signal (7). +The possibility of this error is file-system dependent. .SH VERSIONS .BR fstatat () was added to Linux in kernel 2.6.16;