From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Cox Subject: Re: [PATCH v2] firmware: fix sending -ERESTARTSYS due to signal on fallback Date: Tue, 06 Jun 2017 15:53:16 +0100 Message-ID: <1496760796.5682.48.camel@linux.intel.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170605202410.GQ8951-B4tOwbsTzaBolqkO4TVVkw@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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-d4N2ExZK1jaSe5ORCPIMD9BPR1lH4CV8@public.gmane.org, rafal-g1n6cQUeyibVItvQsEIGlw@public.gmane.org, Arend Van Spriel , "Rafael J. Wysocki" , "Li, Yi" , atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org, Moritz Fischer , Petr Mladek , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Kalle Valo , Linus Torvalds , Kees Cook , AKASHI Takahiro , David Howells List-Id: linux-api@vger.kernel.org > "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