Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751577AbdFFOx2 (ORCPT ); Tue, 6 Jun 2017 10:53:28 -0400 Received: from mga03.intel.com ([134.134.136.65]:36427 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751406AbdFFOx0 (ORCPT ); Tue, 6 Jun 2017 10:53:26 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,306,1493708400"; d="scan'208";a="95217482" Message-ID: <1496760796.5682.48.camel@linux.intel.com> Subject: Re: [PATCH v2] firmware: fix sending -ERESTARTSYS due to signal on fallback From: Alan Cox To: "Luis R. Rodriguez" , Dmitry Torokhov , Peter Zijlstra , Jonathan Corbet , "Eric W. Biederman" , "Michael Kerrisk (man-pages)" , Andy Lutomirski , Greg KH Cc: "Fuzzey, Martin" , Linux API , Daniel Wagner , David Woodhouse , jewalt@lgsinnovations.com, rafal@milecki.pl, Arend Van Spriel , "Rafael J. Wysocki" , "Li, Yi" , atull@opensource.altera.com, Moritz Fischer , Petr Mladek , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Kalle Valo , Linus Torvalds , Kees Cook , AKASHI Takahiro , David Howells , Peter Jones , Hans de G oede , "Ted Ts'o" , "linux-kernel@vger.kernel.org" Date: Tue, 06 Jun 2017 15:53:16 +0100 In-Reply-To: <20170605202410.GQ8951@wotan.suse.de> References: <20170524214027.7775-1-mcgrof@kernel.org> <87fufr3mdy.fsf@xmission.com> <20170526194640.GS8951@wotan.suse.de> <20170526215518.GB40877@dtor-ws> <20170605202410.GQ8951@wotan.suse.de> Organization: Intel Corporation Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 745 Lines: 26 > "Unix tradition (and thus almost all applications) believe file store > writes to > be non signal interruptible. It would not be safe or practical to > change that > guarantee." Yep everyone codes write(disk_file, "foo", 3); not while(..) blah around it. > For these two reasons then it would seem best we do two things > actually: > > 1) return -EINTR instead of -EAGAIN when we detect > swait_event_interruptible_timeout() > got interrupted by a signal (it returns -ERESTARTSYS) > 2) Do as you note below and add wait_event_killable_timeout() Pedantic detail that I don't think affects you If you have completed a part of the I/O then you should return the byte processed count not EINTR, but -1,EINTR if no progress was made. Alan