On Wed, Apr 05 2017, Jeff Layton wrote: >> >> O_DIRECT write() can get an EIO from a previous write-back write to the >> same file. Maybe non-O_DIRECT writes should too? >> > > Some already do this for buffered writes. > > This is really a philosophical question, IMO...is it correct to return > an error on a write call, due to writeback failing previously or during > the write call, quite possibly to a range that the write call does not > touch? I can see an argument either way for this. I like the "we already do" argument. > > Also, if we do think that returning an error on the write is the right > thing to do, should that error advance the sequence counter in the > struct file, such that an fsync afterward gets back 0? My feeling here > is that fsync should still report an error after a failed write, but > maybe that's wrong? My first thought was that one the error has been returned to any syscall on a given fd, it has been returned. Once is enough. My second thought was that maybe your feeling is right. Having a well defined error-return point in fsync feels like a nice design. My third thought was that this would mean either - write continues to fail until fsync is called (probably bad), or - we need two counters per "struct file", one for fsync, one for write. I don't like that much. So I'm going back to my first thought. Thanks, NeilBrown > > This is certainly one area where switching to synchronous writes on > error would make things a little simpler. > -- > Jeff Layton <jlayton@xxxxxxxxxx>
Attachment:
signature.asc
Description: PGP signature