All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: finish dfops on every insert range shift iteration
@ 2020-07-13 20:21 Brian Foster
  2020-08-18 11:08 ` Brian Foster
  2020-08-18 15:06 ` Darrick J. Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Brian Foster @ 2020-07-13 20:21 UTC (permalink / raw)
  To: linux-xfs

The recent change to make insert range an atomic operation used the
incorrect transaction rolling mechanism. The explicit transaction
roll does not finish deferred operations. This means that intents
for rmapbt updates caused by extent shifts are not logged until the
final transaction commits. Thus if a crash occurs during an insert
range, log recovery might leave the rmapbt in an inconsistent state.
This was discovered by repeated runs of generic/455.

Update insert range to finish dfops on every shift iteration. This
is similar to collapse range and ensures that intents are logged
with the transactions that make associated changes.

Fixes: dd87f87d87fa ("xfs: rework insert range into an atomic operation")
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_bmap_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index afdc7f8e0e70..feb277874a1f 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1165,7 +1165,7 @@ xfs_insert_file_space(
 		goto out_trans_cancel;
 
 	do {
-		error = xfs_trans_roll_inode(&tp, ip);
+		error = xfs_defer_finish(&tp);
 		if (error)
 			goto out_trans_cancel;
 
-- 
2.21.3


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

* Re: [PATCH] xfs: finish dfops on every insert range shift iteration
  2020-07-13 20:21 [PATCH] xfs: finish dfops on every insert range shift iteration Brian Foster
@ 2020-08-18 11:08 ` Brian Foster
  2020-08-18 15:06 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Foster @ 2020-08-18 11:08 UTC (permalink / raw)
  To: linux-xfs

On Mon, Jul 13, 2020 at 04:21:51PM -0400, Brian Foster wrote:
> The recent change to make insert range an atomic operation used the
> incorrect transaction rolling mechanism. The explicit transaction
> roll does not finish deferred operations. This means that intents
> for rmapbt updates caused by extent shifts are not logged until the
> final transaction commits. Thus if a crash occurs during an insert
> range, log recovery might leave the rmapbt in an inconsistent state.
> This was discovered by repeated runs of generic/455.
> 
> Update insert range to finish dfops on every shift iteration. This
> is similar to collapse range and ensures that intents are logged
> with the transactions that make associated changes.
> 
> Fixes: dd87f87d87fa ("xfs: rework insert range into an atomic operation")
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---

Ping?

>  fs/xfs/xfs_bmap_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index afdc7f8e0e70..feb277874a1f 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1165,7 +1165,7 @@ xfs_insert_file_space(
>  		goto out_trans_cancel;
>  
>  	do {
> -		error = xfs_trans_roll_inode(&tp, ip);
> +		error = xfs_defer_finish(&tp);
>  		if (error)
>  			goto out_trans_cancel;
>  
> -- 
> 2.21.3
> 


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

* Re: [PATCH] xfs: finish dfops on every insert range shift iteration
  2020-07-13 20:21 [PATCH] xfs: finish dfops on every insert range shift iteration Brian Foster
  2020-08-18 11:08 ` Brian Foster
@ 2020-08-18 15:06 ` Darrick J. Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-08-18 15:06 UTC (permalink / raw)
  To: Brian Foster; +Cc: linux-xfs

On Mon, Jul 13, 2020 at 04:21:51PM -0400, Brian Foster wrote:
> The recent change to make insert range an atomic operation used the
> incorrect transaction rolling mechanism. The explicit transaction
> roll does not finish deferred operations. This means that intents
> for rmapbt updates caused by extent shifts are not logged until the
> final transaction commits. Thus if a crash occurs during an insert
> range, log recovery might leave the rmapbt in an inconsistent state.
> This was discovered by repeated runs of generic/455.
> 
> Update insert range to finish dfops on every shift iteration. This
> is similar to collapse range and ensures that intents are logged
> with the transactions that make associated changes.
> 
> Fixes: dd87f87d87fa ("xfs: rework insert range into an atomic operation")
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Seems reasonable to me, sorry for dropping this by accident. :/

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

--D

> ---
>  fs/xfs/xfs_bmap_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index afdc7f8e0e70..feb277874a1f 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1165,7 +1165,7 @@ xfs_insert_file_space(
>  		goto out_trans_cancel;
>  
>  	do {
> -		error = xfs_trans_roll_inode(&tp, ip);
> +		error = xfs_defer_finish(&tp);
>  		if (error)
>  			goto out_trans_cancel;
>  
> -- 
> 2.21.3
> 

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

end of thread, other threads:[~2020-08-18 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 20:21 [PATCH] xfs: finish dfops on every insert range shift iteration Brian Foster
2020-08-18 11:08 ` Brian Foster
2020-08-18 15:06 ` Darrick J. Wong

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.