mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael K. Edwards" <medwards.linux@gmail.com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: f_owner.lock and file->pos updates
Date: Wed, 7 Mar 2007 18:12:40 -0800	[thread overview]
Message-ID: <f2b55d220703071812l52ef7241h9f2729a9b48ab60d@mail.gmail.com> (raw)
In-Reply-To: <f2b55d220703071750h1a47c432ife7f39c575a4303c@mail.gmail.com>

I wrote:
> I didn't see any clean way to intersperse overwrites and appends to a
> record-structured file without using vfs_llseek, which steps on f_pos.

The context, of course, is an attempt to fix -ENOPATCH with regard to
the netlink-based AIO submission scheme I outlined a couple of days
ago.  :-)

Maybe f_pos should be advanced atomically by the number of bytes
expected to be read/written, before entering the vfs_(read|write)(|v)
call?  And then if the read/write doesn't complete normally, f_pos
should be decremented by the number of bytes we failed to read/write?
Or do we have to make absolutely, positively sure that sampling f_pos
from another thread never returns any value outside (before)..(before
+ bytes read/written)?  If so, the only way to cure the worst symptom
of the append race appears to be to hold a per-fd lock for the
duration of the sys_(read|write).

Cheers,
- Michael

      reply	other threads:[~2007-03-08  2:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07 19:17 Michael K. Edwards
2007-03-08  0:48 ` Alan Cox
2007-03-08  1:50   ` Michael K. Edwards
2007-03-08  2:12     ` Michael K. Edwards [this message]

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=f2b55d220703071812l52ef7241h9f2729a9b48ab60d@mail.gmail.com \
    --to=medwards.linux@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.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 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®