public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range
@ 2021-04-29  5:44 Darrick J. Wong
  2021-04-29  7:28 ` Chandan Babu R
  2021-04-29 13:49 ` Brian Foster
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2021-04-29  5:44 UTC (permalink / raw)
  To: xfs; +Cc: chandanrlinux

From: Darrick J. Wong <djwong@kernel.org>

The final parameter of filemap_write_and_wait_range is the end of the
range to flush, not the length of the range to flush.

Fixes: 46afb0628b86 ("xfs: only flush the unshared range in xfs_reflink_unshare")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/xfs_reflink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 4dd4af6ac2ef..060695d6d56a 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1522,7 +1522,8 @@ xfs_reflink_unshare(
 	if (error)
 		goto out;
 
-	error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
+	error = filemap_write_and_wait_range(inode->i_mapping, offset,
+			offset + len - 1);
 	if (error)
 		goto out;
 

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

* Re: [PATCH] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range
  2021-04-29  5:44 [PATCH] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range Darrick J. Wong
@ 2021-04-29  7:28 ` Chandan Babu R
  2021-04-29 13:49 ` Brian Foster
  1 sibling, 0 replies; 3+ messages in thread
From: Chandan Babu R @ 2021-04-29  7:28 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs

On 29 Apr 2021 at 11:14, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> The final parameter of filemap_write_and_wait_range is the end of the
> range to flush, not the length of the range to flush.
>

Looks good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>

> Fixes: 46afb0628b86 ("xfs: only flush the unshared range in xfs_reflink_unshare")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/xfs_reflink.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 4dd4af6ac2ef..060695d6d56a 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -1522,7 +1522,8 @@ xfs_reflink_unshare(
>  	if (error)
>  		goto out;
>  
> -	error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
> +	error = filemap_write_and_wait_range(inode->i_mapping, offset,
> +			offset + len - 1);
>  	if (error)
>  		goto out;
>  


-- 
chandan

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

* Re: [PATCH] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range
  2021-04-29  5:44 [PATCH] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range Darrick J. Wong
  2021-04-29  7:28 ` Chandan Babu R
@ 2021-04-29 13:49 ` Brian Foster
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Foster @ 2021-04-29 13:49 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs, chandanrlinux

On Wed, Apr 28, 2021 at 10:44:16PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> The final parameter of filemap_write_and_wait_range is the end of the
> range to flush, not the length of the range to flush.
> 
> Fixes: 46afb0628b86 ("xfs: only flush the unshared range in xfs_reflink_unshare")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

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

>  fs/xfs/xfs_reflink.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 4dd4af6ac2ef..060695d6d56a 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -1522,7 +1522,8 @@ xfs_reflink_unshare(
>  	if (error)
>  		goto out;
>  
> -	error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
> +	error = filemap_write_and_wait_range(inode->i_mapping, offset,
> +			offset + len - 1);
>  	if (error)
>  		goto out;
>  
> 


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

end of thread, other threads:[~2021-04-29 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-29  5:44 [PATCH] xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range Darrick J. Wong
2021-04-29  7:28 ` Chandan Babu R
2021-04-29 13:49 ` Brian Foster

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