From: Christoph Hellwig <hch@infradead.org>
To: Alex Elder <aelder@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 7/8] xfsprogs: clean up errors in libxfs_mount() consistently
Date: Mon, 14 Nov 2011 05:28:45 -0500 [thread overview]
Message-ID: <20111114102845.GB31043@infradead.org> (raw)
In-Reply-To: <fa64086e0baa316ab27ca7cffa1e9cd214525a87.1320955676.git.aelder@sgi.com>
On Thu, Nov 10, 2011 at 02:35:17PM -0600, Alex Elder wrote:
> Until the perag structures for the filesystem have been set up,
> initialization of the mount point only assigns computed values and
> has no other side-effects (such as allocating additional
> structures). So up to that point, returning a null pointer to
> signal an error is adequate. Once the perag initialization is done
> there needs to be some teardown in case of an error.
>
> Here the handling of errors is inconsistent. If early perag
> initialization fails, the code currently just exits. Then, if
> getting a reference to the root inode results in an error, a null
> pointer is returned but without first cleaning up the perag
> structures. Next, if rtmount_inodes() returns an error, the
> reference to the root inode (if any) is released, but again the
> perag structures are not cleaned up. Finally, when the perag data
> is read in, if an error occurs, a null pointer is returned but the
> root inode pointer reference is not released and the perag
> structures are not cleaned up.
>
> Remedy all of that by having each of these error cases jump to error
> handling code at the end of the function. That code needs to
> release the reference to the root inode and release all of the perag
> structures. This (plus a few other things that will be no-ops at
> this point in the mount process) is exactly what libxfs_umount(), so
> just use that function to implement this cleanup activity.
>
> Signed-off-by: Alex Elder <aelder@sgi.com>
Did you make sure libxfs_umount doesn't do too much work? I'm usually
more of a fan of uninding each operation individually.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-11-14 10:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 20:35 [PATCH 0/8] xfsprogs: new resvsp db command, plus some fixes Alex Elder
2011-11-10 20:35 ` [PATCH 1/8] xfsprogs: Fix setbitval() bug when nbits is byte-aligned Alex Elder
2011-11-10 20:35 ` [PATCH 2/8] xfsprogs: unconditionally drop used buffer reference Alex Elder
2011-11-13 11:59 ` Christoph Hellwig
2011-11-10 20:35 ` [PATCH 3/8] xfsprogs: xfs_repair: don't set the root inode pointer Alex Elder
2011-11-13 12:01 ` Christoph Hellwig
2012-02-07 18:38 ` Christoph Hellwig
2012-02-07 20:25 ` Kevan Rehm
2012-02-07 21:46 ` Kevan Rehm
2011-11-10 20:35 ` [PATCH 4/8] xfsprogs: mkfs.xfs: let libxfs_umount() do its thing Alex Elder
2011-11-13 12:04 ` Christoph Hellwig
2011-11-10 20:35 ` [PATCH 5/8] xfsprogs: Drop root inode refrerence in libxfs_umount() Alex Elder
2011-11-13 12:07 ` Christoph Hellwig
2011-11-10 20:35 ` [PATCH 6/8] xfsprogs: xfs_db: unmount fs before exiting Alex Elder
2011-11-13 12:09 ` Christoph Hellwig
2011-11-10 20:35 ` [PATCH 7/8] xfsprogs: clean up errors in libxfs_mount() consistently Alex Elder
2011-11-14 10:28 ` Christoph Hellwig [this message]
2011-11-10 20:35 ` [PATCH 8/8] xfsprogs: xfs_db: add new "resvsp" command Alex Elder
2011-11-11 1:29 ` Dave Chinner
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=20111114102845.GB31043@infradead.org \
--to=hch@infradead.org \
--cc=aelder@sgi.com \
--cc=xfs@oss.sgi.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