public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: add missing error check in xfs_prepare_shift()
@ 2019-04-26 12:06 Brian Foster
  2019-04-26 14:30 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Brian Foster @ 2019-04-26 12:06 UTC (permalink / raw)
  To: linux-xfs

xfs_prepare_shift() fails to check the error return from
xfs_flush_unmap_range(). If the latter fails, that could lead to an
insert/collapse range operation over a delalloc range, which is not
supported.

Add an error check and return appropriately. This is reproduced
rarely by generic/475.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_bmap_util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 2db43ff4f8b5..06d07f1e310b 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1193,6 +1193,8 @@ xfs_prepare_shift(
 	 * about to shift down every extent from offset to EOF.
 	 */
 	error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
+	if (error)
+		return error;
 
 	/*
 	 * Clean out anything hanging around in the cow fork now that
-- 
2.17.2

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

* Re: [PATCH] xfs: add missing error check in xfs_prepare_shift()
  2019-04-26 12:06 [PATCH] xfs: add missing error check in xfs_prepare_shift() Brian Foster
@ 2019-04-26 14:30 ` Darrick J. Wong
  2019-04-26 23:39 ` Allison Henderson
  2019-04-28 22:41 ` Dave Chinner
  2 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2019-04-26 14:30 UTC (permalink / raw)
  To: Brian Foster; +Cc: linux-xfs

On Fri, Apr 26, 2019 at 08:06:33AM -0400, Brian Foster wrote:
> xfs_prepare_shift() fails to check the error return from
> xfs_flush_unmap_range(). If the latter fails, that could lead to an
> insert/collapse range operation over a delalloc range, which is not
> supported.
> 
> Add an error check and return appropriately. This is reproduced
> rarely by generic/475.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_bmap_util.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 2db43ff4f8b5..06d07f1e310b 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1193,6 +1193,8 @@ xfs_prepare_shift(
>  	 * about to shift down every extent from offset to EOF.
>  	 */
>  	error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
> +	if (error)
> +		return error;
>  
>  	/*
>  	 * Clean out anything hanging around in the cow fork now that
> -- 
> 2.17.2
> 

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

* Re: [PATCH] xfs: add missing error check in xfs_prepare_shift()
  2019-04-26 12:06 [PATCH] xfs: add missing error check in xfs_prepare_shift() Brian Foster
  2019-04-26 14:30 ` Darrick J. Wong
@ 2019-04-26 23:39 ` Allison Henderson
  2019-04-28 22:41 ` Dave Chinner
  2 siblings, 0 replies; 4+ messages in thread
From: Allison Henderson @ 2019-04-26 23:39 UTC (permalink / raw)
  To: Brian Foster, linux-xfs

Looks ok to me.  You can add my review:

Reviewed-by: Allison Collins <allison.henderson@oracle.com>

On 4/26/19 5:06 AM, Brian Foster wrote:
> xfs_prepare_shift() fails to check the error return from
> xfs_flush_unmap_range(). If the latter fails, that could lead to an
> insert/collapse range operation over a delalloc range, which is not
> supported.
> 
> Add an error check and return appropriately. This is reproduced
> rarely by generic/475.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
>   fs/xfs/xfs_bmap_util.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 2db43ff4f8b5..06d07f1e310b 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1193,6 +1193,8 @@ xfs_prepare_shift(
>   	 * about to shift down every extent from offset to EOF.
>   	 */
>   	error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
> +	if (error)
> +		return error;
>   
>   	/*
>   	 * Clean out anything hanging around in the cow fork now that
> 

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

* Re: [PATCH] xfs: add missing error check in xfs_prepare_shift()
  2019-04-26 12:06 [PATCH] xfs: add missing error check in xfs_prepare_shift() Brian Foster
  2019-04-26 14:30 ` Darrick J. Wong
  2019-04-26 23:39 ` Allison Henderson
@ 2019-04-28 22:41 ` Dave Chinner
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2019-04-28 22:41 UTC (permalink / raw)
  To: Brian Foster; +Cc: linux-xfs

On Fri, Apr 26, 2019 at 08:06:33AM -0400, Brian Foster wrote:
> xfs_prepare_shift() fails to check the error return from
> xfs_flush_unmap_range(). If the latter fails, that could lead to an
> insert/collapse range operation over a delalloc range, which is not
> supported.
> 
> Add an error check and return appropriately. This is reproduced
> rarely by generic/475.
> 
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
>  fs/xfs/xfs_bmap_util.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 2db43ff4f8b5..06d07f1e310b 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1193,6 +1193,8 @@ xfs_prepare_shift(
>  	 * about to shift down every extent from offset to EOF.
>  	 */
>  	error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
> +	if (error)
> +		return error;

Urk. My fault.

Fixes: 7f9f71be84bc ("xfs: extent shifting doesn't fully invalidate page cache")

Not sure how I screwed up that simple change so obviously and didn't
notice it.

Fix for the fix looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

end of thread, other threads:[~2019-04-28 22:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-26 12:06 [PATCH] xfs: add missing error check in xfs_prepare_shift() Brian Foster
2019-04-26 14:30 ` Darrick J. Wong
2019-04-26 23:39 ` Allison Henderson
2019-04-28 22:41 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox