From: Alex Elder <aelder@sgi.com>
To: sekharan@us.ibm.com
Cc: XFS Mailing List <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs: check the return value of xfs_trans_get_buf()
Date: Mon, 19 Sep 2011 11:36:53 -0500 [thread overview]
Message-ID: <1316450213.2941.20.camel@doink> (raw)
In-Reply-To: <1315411298.9298.5.camel@chandra-lucid.austin.ibm.com>
On Wed, 2011-09-07 at 11:01 -0500, Chandra Seetharaman wrote:
> Check the return value of xfs_trans_get_buf() and fail appropriately.
>
> Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Sorry it took a while to get to this.
I started following back some of the paths that
now (with your patch) return ENOMEM where they
might not have before. But I soon gave up because
it explodes a bit in the number of possibilities.
I did verify that the places that now return ENOMEM
have callers that check for an error return, so I'm
going to just trust that's OK and that you have
ensured there aren't any spots that do something
unwanted in the event ENOMEM gets returned.
I did find something that may be a problem, so
I'd like you to take another look and either
explain why it's OK, or send an update to correct
it.
Thanks.
-Alex
. . .
> diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
> index c2ff0fc..a4f3624 100644
> --- a/fs/xfs/xfs_vnodeops.c
> +++ b/fs/xfs/xfs_vnodeops.c
> @@ -308,6 +308,8 @@ xfs_inactive_symlink_rmt(
> bp = xfs_trans_get_buf(tp, mp->m_ddev_targp,
> XFS_FSB_TO_DADDR(mp, mval[i].br_startblock),
> XFS_FSB_TO_BB(mp, mval[i].br_blockcount), 0);
> + if (!bp)
> + goto error1;
In this function, simply going to error1 will result
in a 0 getting returned to the caller, because error
had value 0 at this point. I think you want something
more like:
if (!bp) {
error = ENOMEM;
goto error1;
}
> xfs_trans_binval(tp, bp);
> }
> /*
> @@ -1648,7 +1650,8 @@ xfs_symlink(
> byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
> bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
> BTOBB(byte_cnt), 0);
> - ASSERT(!xfs_buf_geterror(bp));
> + if (!bp)
> + goto error2;
Same thing here. I think you want to set error to
something before the "goto error2".
> if (pathlen < byte_cnt) {
> byte_cnt = pathlen;
> }
>
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-09-19 16:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 16:01 [PATCH] xfs: check the return value of xfs_trans_get_buf() Chandra Seetharaman
2011-09-19 16:36 ` Alex Elder [this message]
2011-09-19 18:34 ` Chandra Seetharaman
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=1316450213.2941.20.camel@doink \
--to=aelder@sgi.com \
--cc=sekharan@us.ibm.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