From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Mason Subject: Re: [PATCH] O_SYNC error handling fix Date: Mon, 16 Jan 2006 09:26:12 -0500 Message-ID: <200601160926.15701.mason@suse.com> References: <200601151943.51771.mason@suse.com> <20060115235852.36a8bcad.akpm@osdl.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from mx2.suse.de ([195.135.220.15]:1465 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1750829AbWAPO0Z (ORCPT ); Mon, 16 Jan 2006 09:26:25 -0500 To: Andrew Morton In-Reply-To: <20060115235852.36a8bcad.akpm@osdl.org> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Monday 16 January 2006 02:58, Andrew Morton wrote: > Chris Mason wrote: > > If we hit errors during generic_osync_inode(), > > generic_file_buffered_write will still return written ? written : status; > > This patch ensures the -EIO gets back up to userland at all times. [ ... ] > > The patch does more than this. It also changes the O_DIRECT logic and it > also refuses to update the file position on I/O errors. True, I can get rid of the O_DIRECT change, it was just to preserve the status variable for the -EIO test. > > Probably reasonable changes, but I'd like to have your description of why > these changes were made please. > Skipping the file position update was because we are not returning the short write. We want the next write to happen at the appropriate place given the number of bytes we've told userland went out. > > The patch also makes write() non-linuxy. We normally return a short write > on errors. In this case I'd say that returning 0 (and not updating f_pos) > would be appropriate? With O_SYNC we've no way of knowing which bytes didn't make it down to the disk. I can special case the -EIO check for just O_SYNC. I think that along with changing around the O_DIRECT bits will make us both happy? -chris