From: Andrew Morton <akpm@linux-foundation.org>
To: Theodore Tso <tytso@mit.edu>
Cc: matthew@wil.cx, hifumi.hisashi@oss.ntt.co.jp,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RESEND] [PATCH] lseek: change i_mutex usage.
Date: Thu, 15 Jan 2009 16:40:03 -0800 [thread overview]
Message-ID: <20090115164003.09c8c918.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090115142113.GD30522@mit.edu>
On Thu, 15 Jan 2009 09:21:13 -0500
Theodore Tso <tytso@mit.edu> wrote:
> On Thu, Jan 15, 2009 at 06:22:52AM -0700, Matthew Wilcox wrote:
> >
> > Of course if you have multiple threads, they will share a struct file,
> > and you're updating f_pos and f_version without locking. Maybe that's
> > OK, but it's soemthing you didn't discuss.
>
> f_pos is updated by sys_write(), and friends without locking, so we're
> fine on that front, or at least no worse off.
bug ;)
> SUSv3 doesn't seem to
> say one way or another what should happen if two threads try to
> write() to a file at the same time using the same file descriptor in
> terms of whether or not f_pos gets updated intelligently. We've opted
> for speed over determinism already.
I think our thinking was that if two threads are racily updating f_pos
with different values, then it should end up with one of those values.
>From a quality-of-implementation POV (what _is_ that, anyway) it would
be bad if the kernel were to set f_pos to the upper 32 bits of position
A and the lower 32 bits of position B. Which could happen if we remove
the i_mutex protection on 32-bits.
We could perhaps omit some locking if CONFIG_64BIT. There's probably
quite a bit of locking which could be omitted in that case.
next prev parent reply other threads:[~2009-01-16 0:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 7:42 [RESEND] [PATCH] lseek: change i_mutex usage Hisashi Hifumi
2009-01-15 13:22 ` Matthew Wilcox
2009-01-15 14:21 ` Theodore Tso
2009-01-15 15:36 ` jim owens
2009-01-16 0:40 ` Andrew Morton [this message]
2009-01-16 0:53 ` Hisashi Hifumi
2009-01-16 1:49 ` Andrew Morton
2009-01-16 2:08 ` Hisashi Hifumi
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=20090115164003.09c8c918.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hifumi.hisashi@oss.ntt.co.jp \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=tytso@mit.edu \
/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).