From: Anton Altaparmakov <aia21@cantab.net>
To: Andrew Morton <akpm@zip.com.au>
Cc: Linus Torvalds <torvalds@transmeta.com>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 13/13] lseek speedup
Date: Wed, 17 Jul 2002 10:45:41 +0100 [thread overview]
Message-ID: <5.1.0.14.2.20020717103038.00a8c7a0@pop.cus.cam.ac.uk> (raw)
In-Reply-To: <3D35012B.EE9B1ABB@zip.com.au>
At 06:31 17/07/02, Andrew Morton wrote:
>This is a fairly dopey patch to fix up the i_sem contention in lseek.
>Better ideas are welcome, but I'm offline until Monday so don't think
>I'm ignoring them...
I am afraid I don't have any better ideas but I don't think your patch is
safe. )-:
>We need to decide what we really want to lock in there. If multiple
>threads are updating f_pos and/or i_size at the same time then they are
>going to see strange results whatever the kernel does. I'd maintain
>that the only real obligation which the kernel has in this situation is
>to not oops, to not munch data and to not return competely outlandish
>results.
That can only be guaranteed by holding i_sem. Since the BKL was taken out
of ->readdir(), i_sem is now used for exclusion between ->readdir() and
->llseek() (well NTFS uses it anyway but many other fs which switched to
generic_file_llseek() do the same). This exclusion is necessary IMHO.
->readdir() may well blow up or at the very least give "completely
outlandish results" if someone modifies f_pos while it is running.
Depending on when exactly it happens, ntfs_readdir() is going to be ok as
it mostly sets f_pos instead of incrementing it but still, a succeeding
->llseek(), may actually end up in a different position to the one
requested because of a concurrent ->readdir().
I know doing the two things at the same time requires a completely crazy
multithreaded application, but then again many application developers fall
into that category. (-;
>And the only way we can return outlandish results is on 32-bit SMP if
>one CPU reads i_size or f_pos while another CPU is in the middle of
>modifying it.
I believe it can also happen if ->llseek() is allowed to run concurrently
with a ->readdir()...
Best regards,
Anton
--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
next prev parent reply other threads:[~2002-07-17 9:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-17 5:31 Andrew Morton
2002-07-17 9:45 ` Anton Altaparmakov [this message]
2002-07-17 16:18 ` Andrew Morton
2002-07-17 16:20 ` Anton Altaparmakov
2002-07-17 16:49 ` Andrew Morton
2002-07-17 18:07 ` Anton Altaparmakov
2002-07-22 7:16 ` Andrew Morton
2002-07-22 7:43 ` Anton Altaparmakov
2002-07-17 18:27 ` Benjamin LaHaise
2002-07-17 10:54 ` Anton Altaparmakov
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=5.1.0.14.2.20020717103038.00a8c7a0@pop.cus.cam.ac.uk \
--to=aia21@cantab.net \
--cc=akpm@zip.com.au \
--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®