From: Theodore Ts'o <tytso@mit.edu>
To: linux-ext4@vger.kernel.org
Subject: Re: Minimal configuration for e2fsprogs
Date: Wed, 27 Jun 2012 08:54:43 -0400 [thread overview]
Message-ID: <20120627125443.GA32356@thunk.org> (raw)
In-Reply-To: <20120627112117.GA15231@thor.bakeyournoodle.com>
On Wed, Jun 27, 2012 at 09:21:17PM +1000, Tony Breeds wrote:
>
> Calling perror/exit from this deep in a library doesn't seem right to me I
> think a better option would be to change rb_get_new_extent()
> to return an errcode_t and pass that up the call chain. I'm happy to do
> that. If I read rb_insert_extent() correctly I can simply return if
> rb_get_new_extent() failed, as nothing as been changed at this point
> you've only traversed the rb tree. The problem is that very few of the
> callers of rb_insert_extent() actually check the return value :( so this
> patch will be a little bigger than I'd like.
Well, rb_insert_extent() isn't returning an error; it's returning
whether or not it needed to insert an extent or not. And the bigger
problem is there's no way to return an error all the way up the
callchain, since it ultimately gets called by functions like
ext2fs_mark_block_bitmap() which never contemplated that the function
might fail.
So there really is no way to return an error at this point, and if you
fail allocating memory, we're kind of doomed anyway. We could replace
this with an abort(), but there's really not much else we can do here.
I suppose, more generally, we could add a new callback which gets
called on memory allocation failures; although in practice, the place
where we are most likely to run into trouble is e2fsck, and we already
have sufficient debugging code there thanks to e2fsck/sigcatcher.c.
So maybe just using an abort() is the best approach for now.
> The qsort calls scare me a little. I expect that bad things would
> happen if the directory block wasn't sorted. So just providing a
> qsort() in yaboot that does nothing would be a bad thing. I'm
> kind of hoping you'll just say "as long as you're opening the
> file-system read-only the directory block will be sorted so don't sweat
> it" Am I dreaming?
So I believe the only place where the dblist.o file is getting dragged
in is due to the call to ext2fs_free_dblist() in freefs.c. Can you
confirm this?
If so, probably the way to solve this is the via the same trick we do
with fs->write_bitmaps() --- see how we only call fs->write_bitmaps()
if it is defined in ext2fs_close2(); this was done precisely to avoid
dragging in the write_bitmaps code if it's not needed for programs
which are opening the file system read/only.
Regards,
- Ted
next prev parent reply other threads:[~2012-06-27 12:54 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 4:24 Minimal configuration for e2fsprogs Tony Breeds
2012-06-16 0:08 ` Ted Ts'o
2012-06-18 5:58 ` Tony Breeds
2012-06-18 17:12 ` Ted Ts'o
2012-06-19 5:48 ` Tony Breeds
2012-06-19 6:01 ` Andreas Dilger
2012-06-19 13:56 ` Ted Ts'o
2012-06-20 5:26 ` Tony Breeds
2012-06-20 5:33 ` Tony Breeds
2012-06-20 14:14 ` Andreas Dilger
2012-06-20 4:45 ` Tony Breeds
2012-06-26 2:10 ` Tony Breeds
2012-06-26 2:33 ` Theodore Ts'o
2012-06-26 2:47 ` Tony Breeds
2012-06-27 11:21 ` Tony Breeds
2012-06-27 12:54 ` Theodore Ts'o [this message]
2012-06-28 2:43 ` Tony Breeds
2012-07-30 21:45 ` Theodore Ts'o
2012-07-31 5:21 ` Tony Breeds
2012-07-31 19:57 ` Theodore Ts'o
2012-08-01 5:42 ` Tony Breeds
2012-07-30 21:47 ` [PATCH 1/7] e2fsck: add SIGABRT to list of signals processed by sigcatcher Theodore Ts'o
2012-07-30 21:47 ` [PATCH 2/7] libext2fs: use abort() instead of perror()/exit() Theodore Ts'o
2012-07-31 18:34 ` Andreas Dilger
2012-07-31 20:04 ` Theodore Ts'o
2012-07-30 21:47 ` [PATCH 3/7] libext2fs: use strcpy()/strcat() instead of sprintf() in bmap functions Theodore Ts'o
2012-07-30 21:47 ` [PATCH 4/7] libext2fs: move ext2fs_get_num_dirs to its own file Theodore Ts'o
2012-07-30 21:47 ` [PATCH 5/7] libext2fs: call numeric_progress functions through a operations struct Theodore Ts'o
2012-07-30 21:47 ` [PATCH 6/7] libext2fs: remove debugging printf from ext2fs_group_desc_csum Theodore Ts'o
2012-07-30 21:47 ` [PATCH 7/7] libext2fs: enforce the block group descriptor size in ext2fs_open() Theodore Ts'o
2012-07-31 18:38 ` Andreas Dilger
2012-07-31 20:09 ` Theodore Ts'o
2012-08-01 20:45 ` Andreas Dilger
2012-08-03 0:00 ` Theodore Ts'o
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=20120627125443.GA32356@thunk.org \
--to=tytso@mit.edu \
--cc=linux-ext4@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;
as well as URLs for NNTP newsgroup(s).