linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xfs: BMAPX shouldn't barf on inline-format directories
@ 2017-05-10 18:23 Darrick J. Wong
  2017-05-10 19:41 ` Brian Foster
  2017-05-11 12:12 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2017-05-10 18:23 UTC (permalink / raw)
  To: xfs; +Cc: Brian Foster

When we're fulfilling a BMAPX request, jump out early if the data fork
is in local format.  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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: move the check earlier in the function
---
 fs/xfs/xfs_bmap_util.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 7ac80a1..3aefcf2 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -582,9 +582,13 @@ xfs_getbmap(
 		}
 		break;
 	default:
+		/* Local format data forks report no extents. */
+		if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
+			bmv->bmv_entries = 0;
+			return 0;
+		}
 		if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&
-		    ip->i_d.di_format != XFS_DINODE_FMT_BTREE &&
-		    ip->i_d.di_format != XFS_DINODE_FMT_LOCAL)
+		    ip->i_d.di_format != XFS_DINODE_FMT_BTREE)
 			return -EINVAL;
 
 		if (xfs_get_extsz_hint(ip) ||

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xfs: BMAPX shouldn't barf on inline-format directories
  2017-05-10 18:23 [PATCH v2] xfs: BMAPX shouldn't barf on inline-format directories Darrick J. Wong
@ 2017-05-10 19:41 ` Brian Foster
  2017-05-11 12:12 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Foster @ 2017-05-10 19:41 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On Wed, May 10, 2017 at 11:23:25AM -0700, Darrick J. Wong wrote:
> When we're fulfilling a BMAPX request, jump out early if the data fork
> is in local format.  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.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Looks good:

Reviewed-by: Brian Foster <bfoster@redhat.com>

> v2: move the check earlier in the function
> ---
>  fs/xfs/xfs_bmap_util.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 7ac80a1..3aefcf2 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -582,9 +582,13 @@ xfs_getbmap(
>  		}
>  		break;
>  	default:
> +		/* Local format data forks report no extents. */
> +		if (ip->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
> +			bmv->bmv_entries = 0;
> +			return 0;
> +		}
>  		if (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS &&
> -		    ip->i_d.di_format != XFS_DINODE_FMT_BTREE &&
> -		    ip->i_d.di_format != XFS_DINODE_FMT_LOCAL)
> +		    ip->i_d.di_format != XFS_DINODE_FMT_BTREE)
>  			return -EINVAL;
>  
>  		if (xfs_get_extsz_hint(ip) ||

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xfs: BMAPX shouldn't barf on inline-format directories
  2017-05-10 18:23 [PATCH v2] xfs: BMAPX shouldn't barf on inline-format directories Darrick J. Wong
  2017-05-10 19:41 ` Brian Foster
@ 2017-05-11 12:12 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-05-11 12:12 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs, Brian Foster

On Wed, May 10, 2017 at 11:23:25AM -0700, Darrick J. Wong wrote:
> When we're fulfilling a BMAPX request, jump out early if the data fork
> is in local format.  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.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-11 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-10 18:23 [PATCH v2] xfs: BMAPX shouldn't barf on inline-format directories Darrick J. Wong
2017-05-10 19:41 ` Brian Foster
2017-05-11 12:12 ` Christoph Hellwig

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).