All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact()
Date: Tue, 8 Jul 2014 18:00:25 +0100	[thread overview]
Message-ID: <53BC23A9.8000808@citrix.com> (raw)
In-Reply-To: <21436.9020.757598.972931@mariner.uk.xensource.com>

On 08/07/14 17:58, Ian Jackson wrote:
> Andrew Cooper writes ("Re: [Xen-devel] [PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact()"):
>> Final paragraph in the DESCRIPTION
>>
>> "The data transfers performed by readv() and writev() are atomic: the
>> data written by writev() is written as a single block that is not
>> intermingled with output from writes in other processes"
>>
>> By my reading, it cannot guarantee atomicity if it would split an iov[]
>> element.
> Firstly, we should be using the spec, not manpages:
>  http://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html
>  http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
> etc.
>
> There are various guarantees that write and writev provide, including
> the special rule for pipes (from write.html):
>
>   Write requests to a pipe or FIFO shall be handled in the same way as
>   a regular file with the following exceptions:
>      [ complicated rules involving PIPE_BUF ]
>
> and the general rule about system call atomicity:
>
>  http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_07
>
>  All of the following functions shall be atomic with respect to each
>  other in the effects specified in POSIX.1-2008 when they operate on
>  regular files or symbolic links:
>     [...] write() writev() [...]
>
> However neither of these are the guarantee that you are assuming.
>
> In particular, there is nothing saying that _if_ writev performs a
> partial write, it won't stop inside an iov.
>
> Ian.

Ok - in which case v1 of the patch is correct.  I shall submit v3 which
looks similar to v1, but with some comments improvements

~Andrew

  parent reply	other threads:[~2014-07-08 17:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 10:18 [PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact() Andrew Cooper
2014-07-08  3:30 ` Hongyang Yang
2014-07-08  9:27 ` David Vrabel
2014-07-08  9:32   ` Andrew Cooper
2014-07-08 16:58     ` Ian Jackson
2014-07-02 18:04       ` [PATCH] " Andrew Cooper
2014-07-03 17:15         ` Ian Jackson
2014-07-03 17:41           ` Andrew Cooper
2014-07-08 17:00       ` Andrew Cooper [this message]
2014-07-08 17:10         ` [PATCH] tools/libxc: Implement writev_exact() in the same style as write_exact() [and 1 more messages] Ian Jackson
2014-07-08 16:53 ` [PATCH v2] tools/libxc: Implement writev_exact() in the same style as write_exact() Ian Jackson

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=53BC23A9.8000808@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.