mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Becker <jlbec@evilplan.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: O_DIRECT wierd behavior..
Date: Mon, 17 Dec 2001 19:53:12 +0000	[thread overview]
Message-ID: <20011217195312.K31706@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20011217181840.G2431@athlon.random> <Pine.LNX.4.21.0112171757530.2812-100000@localhost.localdomain> <3C1E400B.A4D25F9D@zip.com.au> <9vlgsd$1b7$1@penguin.transmeta.com>
In-Reply-To: <9vlgsd$1b7$1@penguin.transmeta.com>; from torvalds@transmeta.com on Mon, Dec 17, 2001 at 07:26:05PM +0000

On Mon, Dec 17, 2001 at 07:26:05PM +0000, Linus Torvalds wrote:
> Andrew Morton  <akpm@zip.com.au> wrote:
> >I take that to mean that if an error occurs, we return that
> >error regardless of how much was written.
> 
> I disagree.
> 
> Note that writing 15 characters out of 30 is also a "successful write" -
> it's just a _partial_ write.
> 
> >Which makes sense.  Consider this code:
> >
> >	open(file)
> >	write(100k)
> >	close(fd)
> >
> >if the write gets an IO error halfway through, it looks like
> >the caller never gets to hear about it at present.

	IIRC, SUS states that if a fatal error occurred causing the
partial write, that error will be returned on the next write or upon
close().  Thus:

	/* Smart program handles partial writes */
	write(100k); = 50k
	write(remaining 50k); = -1/ENOSPC|EIO|etc

or:

	/* Dumb program doesn't handle partial write */
	write(100k); = 50k
	close(fd); = -1/EIO
	
Joel

-- 

Life's Little Instruction Book #444

	"Never underestimate the power of a kind word or deed."

			http://www.jlbec.org/
			jlbec@evilplan.org

  reply	other threads:[~2001-12-17 19:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-16  0:47 Suresh Gopalakrishnan
2001-12-16  5:59 ` Andrew Morton
2001-12-16  6:29 ` GOTO Masanori
2001-12-16  8:17 ` GOTO Masanori
2001-12-16  8:46   ` Andrew Morton
2001-12-16  9:20     ` Suresh Gopalakrishnan
2001-12-16 13:57       ` Terje Eggestad
2001-12-16 17:43         ` Suresh Gopalakrishnan
2001-12-17  9:04           ` Terje Eggestad
2001-12-17 17:18   ` Andrea Arcangeli
2001-12-17 18:07     ` Hugh Dickins
2001-12-17 18:13       ` Andrea Arcangeli
2001-12-17 18:57       ` Andrew Morton
2001-12-17 19:26         ` Linus Torvalds
2001-12-17 19:53           ` Joel Becker [this message]
2001-12-17 19:59             ` Linus Torvalds
2001-12-17 20:20               ` Joel Becker
2001-12-17 20:38                 ` Andre Hedrick
2001-12-26 14:54           ` Riley Williams
2002-01-20  4:16 ` multithreaded RPC handling Suresh Gopalakrishnan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011217195312.K31706@parcelfarce.linux.theplanet.co.uk \
    --to=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®