From: Theodore Ts'o <tytso@mit.edu>
To: Phillip Susi <psusi@ubuntu.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] e2fslibs: fix llseek on i386
Date: Thu, 24 Jan 2013 23:13:13 -0500 [thread overview]
Message-ID: <20130125041313.GF28908@thunk.org> (raw)
In-Reply-To: <1359044517-18243-1-git-send-email-psusi@ubuntu.com>
On Thu, Jan 24, 2013 at 11:21:56AM -0500, Phillip Susi wrote:
> ext2fs_llseek() was using lseek instead of lseek64. The
> only time it would use lseek64 is if passed an offset that
> overflowed 32 bits. This works for SEEK_SET, but not
> SEEK_CUR, which can apply a small offset to move the file
> pointer past the 32 bit limit.
>
> The code has been changed to instead try lseek64 first, and
> fall back to lseek if that fails. It also was doing a
> runtime check of the size of off_t. This has been moved to
> compile time.
>
> Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Applied, although I had to make a small change so that in the case
where llseek doesn't exist, we need to retry with lseek immediately.
Also, in the fallback case, we still need to make the runtime check to
assure that the requested offset is less than off_t.
On the 1.43 branch it probably makes sense to get rid of the whole
mess with my_llseek and just use llseek64 directly. There's a bunch
of complexity here which because over a decade ago, glibc had a buggy
header files which caused llseek64 to malfunction (which is why I
didn't enable use of llseek64 and > 2GB file system support in the
first place), and the Debian developer at the time tried to be too
clever and shipped a patched version of e2fsprogs which tried to use
llseek64 without consulting me first, and then users started losing
data and having the file systems corrupted as a result.
So as a result, because I couldn't trust glibc to give me a non-buggy
version of llseek64, and Debian users were losing data in real time, I
had e2fsprogs call the system call directly. It's been a long time
since systems with this particular glibc Fail have been around, so
eventually I should rip out a lot of this mess.
- Ted
next prev parent reply other threads:[~2013-01-25 4:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 16:21 [PATCH] e2fslibs: fix llseek on i386 Phillip Susi
2013-01-24 19:51 ` Theodore Ts'o
2013-01-24 20:22 ` Phillip Susi
2013-01-24 20:32 ` Theodore Ts'o
2013-01-25 2:25 ` Zheng Liu
2013-01-25 2:16 ` Theodore Ts'o
2013-01-25 2:48 ` Zheng Liu
2013-01-25 4:13 ` Theodore Ts'o [this message]
2013-01-25 4:14 ` [PATCH] libext2fs: fix ext2fs_llseek " Theodore Ts'o
2013-01-25 4:34 ` Phillip Susi
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=20130125041313.GF28908@thunk.org \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=psusi@ubuntu.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;
as well as URLs for NNTP newsgroup(s).