All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Subject: [PATCH] xfs: bmap shouldn't barf on inline-format directories
Date: Wed, 10 May 2017 09:03:29 -0700	[thread overview]
Message-ID: <20170510160329.GS5973@birch.djwong.org> (raw)

When we're fulfilling a BMAPX request, check that the fork is still in
extents or btree format just prior to calling bmapi.  This prevents us
from hitting a debugging check in bmapi_read and barfing errors back
to userspace.  The on-disk extent count check later isn't sufficient for
IF_DELALLOC mode because da extents are in memory and not on disk.

To reproduce, run "xfs_io -c 'bmap -e'" on any inline directory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_bmap_util.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 7ac80a1..378f142 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -614,6 +614,11 @@ xfs_getbmap(
 		return -EINVAL;
 	bmvend = bmv->bmv_offset + bmv->bmv_length;
 
+	/* Local format inodes don't have any extents to report. */
+	if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
+		bmv->bmv_entries = 0;
+		return 0;
+	}
 
 	if (bmv->bmv_count > ULONG_MAX / sizeof(struct getbmapx))
 		return -ENOMEM;

             reply	other threads:[~2017-05-10 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 16:03 Darrick J. Wong [this message]
2017-05-10 18:10 ` [PATCH] xfs: bmap shouldn't barf on inline-format directories Brian Foster
2017-05-10 18:17   ` Darrick J. Wong

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=20170510160329.GS5973@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.