From: Allison Collins <allison.henderson@oracle.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>, sandeen@sandeen.net
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/5] xfs_repair: fix dir_read_buf use of libxfs_da_read_buf
Date: Mon, 6 Apr 2020 15:09:37 -0700 [thread overview]
Message-ID: <e84c9740-cf9a-fe7d-e38c-d1c775774f6a@oracle.com> (raw)
In-Reply-To: <158619916916.469742.10169263890587590189.stgit@magnolia>
On 4/6/20 11:52 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> xfs_da_read_buf dropped the 'mappedbno' argument in favor of a flags
> argument. Foolishly, we're passing that parameter (which is -1 in all
> callers) to xfs_da_read_buf, which gets us the wrong behavior.
>
> Since mappedbno == -1 meant "complain if we fall into a hole" (which is
> the default behavior of xfs_da_read_buf) we can fix this by passing a
> zero flags argument and getting rid of mappedbno entirely.
>
> Coverity-id: 1457898
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
I dont see any logical errors
Reviewed-by: Allison Collins <allison.henderson@oracle.com>
> ---
> repair/phase6.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index 3fb1af24..beceea9a 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -179,7 +179,6 @@ static int
> dir_read_buf(
> struct xfs_inode *ip,
> xfs_dablk_t bno,
> - xfs_daddr_t mappedbno,
> struct xfs_buf **bpp,
> const struct xfs_buf_ops *ops,
> int *crc_error)
> @@ -187,14 +186,13 @@ dir_read_buf(
> int error;
> int error2;
>
> - error = -libxfs_da_read_buf(NULL, ip, bno, mappedbno, bpp,
> - XFS_DATA_FORK, ops);
> + error = -libxfs_da_read_buf(NULL, ip, bno, 0, bpp, XFS_DATA_FORK, ops);
>
> if (error != EFSBADCRC && error != EFSCORRUPTED)
> return error;
>
> - error2 = -libxfs_da_read_buf(NULL, ip, bno, mappedbno, bpp,
> - XFS_DATA_FORK, NULL);
> + error2 = -libxfs_da_read_buf(NULL, ip, bno, 0, bpp, XFS_DATA_FORK,
> + NULL);
> if (error2)
> return error2;
>
> @@ -2035,8 +2033,7 @@ longform_dir2_check_leaf(
> int fixit = 0;
>
> da_bno = mp->m_dir_geo->leafblk;
> - error = dir_read_buf(ip, da_bno, -1, &bp, &xfs_dir3_leaf1_buf_ops,
> - &fixit);
> + error = dir_read_buf(ip, da_bno, &bp, &xfs_dir3_leaf1_buf_ops, &fixit);
> if (error == EFSBADCRC || error == EFSCORRUPTED || fixit) {
> do_warn(
> _("leaf block %u for directory inode %" PRIu64 " bad CRC\n"),
> @@ -2137,8 +2134,8 @@ longform_dir2_check_node(
> * a node block, then we'll skip it below based on a magic
> * number check.
> */
> - error = dir_read_buf(ip, da_bno, -1, &bp,
> - &xfs_da3_node_buf_ops, &fixit);
> + error = dir_read_buf(ip, da_bno, &bp, &xfs_da3_node_buf_ops,
> + &fixit);
> if (error) {
> do_warn(
> _("can't read leaf block %u for directory inode %" PRIu64 ", error %d\n"),
> @@ -2205,8 +2202,8 @@ longform_dir2_check_node(
> if (bmap_next_offset(NULL, ip, &next_da_bno, XFS_DATA_FORK))
> break;
>
> - error = dir_read_buf(ip, da_bno, -1, &bp,
> - &xfs_dir3_free_buf_ops, &fixit);
> + error = dir_read_buf(ip, da_bno, &bp, &xfs_dir3_free_buf_ops,
> + &fixit);
> if (error) {
> do_warn(
> _("can't read freespace block %u for directory inode %" PRIu64 ", error %d\n"),
> @@ -2367,7 +2364,7 @@ longform_dir2_entry_check(xfs_mount_t *mp,
> else
> ops = &xfs_dir3_data_buf_ops;
>
> - error = dir_read_buf(ip, da_bno, -1, &bplist[db], ops, &fixit);
> + error = dir_read_buf(ip, da_bno, &bplist[db], ops, &fixit);
> if (error) {
> do_warn(
> _("can't read data block %u for directory inode %" PRIu64 " error %d\n"),
>
next prev parent reply other threads:[~2020-04-06 22:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 18:52 [PATCH 0/5] xfsprogs: rollup of various fixes for 5.6 Darrick J. Wong
2020-04-06 18:52 ` [PATCH 1/5] libxfs: don't barf in libxfs_bwrite on a null buffer ops name Darrick J. Wong
2020-04-06 22:06 ` Allison Collins
2020-04-09 7:43 ` Christoph Hellwig
2020-04-06 18:52 ` [PATCH 2/5] libxfs: check return value of device flush when closing device Darrick J. Wong
2020-04-06 22:06 ` Allison Collins
2020-04-09 7:43 ` Christoph Hellwig
2020-04-06 18:52 ` [PATCH 3/5] xfs_db: clean up the salvage read callsites in set_cur() Darrick J. Wong
2020-04-06 22:07 ` Allison Collins
2020-04-06 18:52 ` [PATCH 4/5] xfs_repair: fix dir_read_buf use of libxfs_da_read_buf Darrick J. Wong
2020-04-06 22:09 ` Allison Collins [this message]
2020-04-07 19:05 ` Eric Sandeen
2020-04-09 7:44 ` Christoph Hellwig
2020-04-06 18:52 ` [PATCH 5/5] xfs_scrub: fix type error in render_ino_from_handle Darrick J. Wong
2020-04-06 22:09 ` Allison Collins
2020-04-09 7:44 ` Christoph Hellwig
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=e84c9740-cf9a-fe7d-e38c-d1c775774f6a@oracle.com \
--to=allison.henderson@oracle.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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