9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Roman Shaposhnik <rvs@sun.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] 9pfuse and O_APPEND
Date: Thu, 18 Dec 2008 19:03:02 -0800	[thread overview]
Message-ID: <31B5545F-E1A1-4526-8450-C81E9D16379D@sun.com> (raw)
In-Reply-To: <dd6fe68a0812181557u28bf4c9drc1bdb417d6e4d1ed@mail.gmail.com>

On Dec 18, 2008, at 3:57 PM, Russ Cox wrote:
> I would just seek to the end.

Got it. In that case, is there any reason the current version
of 9pfuse doesn't just skip O_APPEND (like it does with
O_LARGEFILE, etc.)? Since 9pfuse revalidate i_size
before writes that's the best one can do anyway(*)

The following patch seems to work for me. If there's
any reason for it NOT to be included in the Hg repo
please let me know:

--- main.c	2008-12-18 18:41:19.000000000 -0800
+++ src/cmd/9pfuse/main.c	2008-12-18 18:03:27.000000000 -0800
@@ -576,7 +576,7 @@
  	flags = in->flags;
  	openmode = flags&3;
  	flags &= ~3;
-	flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC);
+	flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC|O_APPEND);
  	if(flags & O_TRUNC){
  		openmode |= OTRUNC;
  		flags &= ~O_TRUNC;

> That's fine unless you have multiple
> programs writing O_APPEND simultaneously,
> in which case you are asking for trouble.


Agreed. Now, here's a bit that I still don't quite
understand: Plan9 does have DMAPPEND on
a per-Qid basis. Why was it decided not to
have it on a per-Fid basis (which would match
POSIX semantics 100%)?

The way I understand -- DMAPPEND is just a hint
to the server to *alway* ignore the offset in
incoming writes. It seems that ignoring offsets
in writes for the Fids that asked for it wouldn't be
much more difficult, would it?

Thanks,
Roman.

(*) After some close examination of the 2.6.27 kernel I actually
wonder why v9fs guys
do an explicit seek in there open.

P.S. Its not different clients I'm worried about. Its something
like this within a single broken client:

     int fd = open("/tmp/test.txt", O_RDWR|O_APPEND);
     write(fd, "12345", 5);
     lseek(fd, 1, 0);
     write(fd, "00000", 5);



  parent reply	other threads:[~2008-12-19  3:03 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-18 23:34 Roman Shaposhnik
2008-12-18 23:57 ` Russ Cox
2008-12-19  0:03   ` ron minnich
2008-12-19  3:06     ` Roman Shaposhnik
2008-12-19  3:26       ` ron minnich
2008-12-19  3:59         ` Roman Shaposhnik
2008-12-19 16:44           ` ron minnich
2008-12-19 19:21             ` Anthony Sorace
2008-12-19 19:31               ` erik quanstrom
2008-12-19 19:41               ` ron minnich
2008-12-19 19:59             ` Roman Shaposhnik
2008-12-19 20:06               ` erik quanstrom
2008-12-19 20:18               ` Charles Forsyth
2008-12-21  5:08                 ` Roman V. Shaposhnik
2008-12-19  3:03   ` Roman Shaposhnik [this message]
2008-12-19  3:43     ` erik quanstrom
2008-12-19  3:54       ` Roman Shaposhnik
2008-12-19  4:13         ` geoff
2008-12-19  8:23           ` Russ Cox
2008-12-19 19:49             ` Roman Shaposhnik
2008-12-19 19:56               ` erik quanstrom
2008-12-19 20:10                 ` Roman Shaposhnik
2008-12-19 20:22                   ` erik quanstrom
2008-12-19 20:02               ` ron minnich
2008-12-19 14:21           ` erik quanstrom
2008-12-19 21:00 ` ron minnich
2008-12-19 21:32   ` Charles Forsyth
2008-12-19 21:29     ` ron minnich
2008-12-21  5:05   ` Roman V. Shaposhnik
2008-12-21 14:45     ` erik quanstrom
2008-12-22 10:02       ` roger peppe
2008-12-25  6:04       ` Roman Shaposhnik
2008-12-25  6:33         ` erik quanstrom

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=31B5545F-E1A1-4526-8450-C81E9D16379D@sun.com \
    --to=rvs@sun.com \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).