linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] xfs: AGI buffer type handling
@ 2016-11-30 22:36 Eric Sandeen
  2016-11-30 22:40 ` [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket Eric Sandeen
  2016-11-30 22:42 ` [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi Eric Sandeen
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Sandeen @ 2016-11-30 22:36 UTC (permalink / raw)
  To: linux-xfs

We were missing a xfs_trans_buf_set_type() to XFS_BLFT_AGI_BUF
in xlog_recover_clear_agi_bucket.

Fix this in 2 stages; first simply add it to this function for
simple -stable backports, then move all of them into
xfs_read_agi() so it doesn't get forgotten again.

-Eric

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

* [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket
  2016-11-30 22:36 [PATCH 0/2] xfs: AGI buffer type handling Eric Sandeen
@ 2016-11-30 22:40 ` Eric Sandeen
  2016-12-01 12:15   ` Brian Foster
  2016-12-02 13:15   ` Christoph Hellwig
  2016-11-30 22:42 ` [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi Eric Sandeen
  1 sibling, 2 replies; 8+ messages in thread
From: Eric Sandeen @ 2016-11-30 22:40 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs

xlog_recover_clear_agi_bucket didn't set the
type to XFS_BLFT_AGI_BUF, so we got a warning during log
replay (or an ASSERT on a debug build).

    XFS (md0): Unknown buffer type 0!
    XFS (md0): _xfs_buf_ioapply: no ops on block 0xaea8802/0x1

Fix this, as was done in f19b872b for 2 other locations
with the same problem.

cc: <stable@vger.kernel.org> # 3.10 to current
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 9b3d7c7..2d91f5a 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -4929,6 +4929,7 @@ static inline bool xlog_item_is_intent(struct xfs_log_item *lip)
 	agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		 (sizeof(xfs_agino_t) * bucket);
+	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 


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

* [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi
  2016-11-30 22:36 [PATCH 0/2] xfs: AGI buffer type handling Eric Sandeen
  2016-11-30 22:40 ` [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket Eric Sandeen
@ 2016-11-30 22:42 ` Eric Sandeen
  2016-12-01 12:15   ` Brian Foster
  2016-12-01 17:43   ` [PATCH 2/2 V2] " Eric Sandeen
  1 sibling, 2 replies; 8+ messages in thread
From: Eric Sandeen @ 2016-11-30 22:42 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs

We've missed properly setting the buffer type for
an AGI transaction in 3 spots now, so just move it
into xfs_read_agi() and set it if we are in a transaction
to avoid the problem in the future.

This is similar to how it is done in i.e. the dir3
and attr3 read functions.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 51b4e0d..c482b97 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2450,8 +2450,6 @@
 	ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
 #endif
 
-	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_AGI_BUF);
-
 	/*
 	 * Compute byte offsets for the first and last fields in the first
 	 * region and log the agi buffer. This only logs up through
@@ -2592,6 +2590,8 @@
 			XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);
 	if (error)
 		return error;
+	if (tp)
+		xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_AGI_BUF);
 
 	xfs_buf_set_ref(*bpp, XFS_AGI_REF);
 	return 0;
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 4e560e6..36e6372 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2133,7 +2133,6 @@
 		agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
 		offset = offsetof(xfs_agi_t, agi_unlinked) +
 			(sizeof(xfs_agino_t) * bucket_index);
-		xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 		xfs_trans_log_buf(tp, agibp, offset,
 				  (offset + sizeof(xfs_agino_t) - 1));
 	} else {
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 2d91f5a..9b3d7c7 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -4929,7 +4929,6 @@ static inline bool xlog_item_is_intent(struct xfs_log_item *lip)
 	agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		 (sizeof(xfs_agino_t) * bucket);
-	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 


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

* Re: [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket
  2016-11-30 22:40 ` [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket Eric Sandeen
@ 2016-12-01 12:15   ` Brian Foster
  2016-12-02 13:15   ` Christoph Hellwig
  1 sibling, 0 replies; 8+ messages in thread
From: Brian Foster @ 2016-12-01 12:15 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

On Wed, Nov 30, 2016 at 04:40:18PM -0600, Eric Sandeen wrote:
> xlog_recover_clear_agi_bucket didn't set the
> type to XFS_BLFT_AGI_BUF, so we got a warning during log
> replay (or an ASSERT on a debug build).
> 
>     XFS (md0): Unknown buffer type 0!
>     XFS (md0): _xfs_buf_ioapply: no ops on block 0xaea8802/0x1
> 
> Fix this, as was done in f19b872b for 2 other locations
> with the same problem.
> 
> cc: <stable@vger.kernel.org> # 3.10 to current
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---

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

> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 9b3d7c7..2d91f5a 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -4929,6 +4929,7 @@ static inline bool xlog_item_is_intent(struct xfs_log_item *lip)
>  	agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
>  	offset = offsetof(xfs_agi_t, agi_unlinked) +
>  		 (sizeof(xfs_agino_t) * bucket);
> +	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
>  	xfs_trans_log_buf(tp, agibp, offset,
>  			  (offset + sizeof(xfs_agino_t) - 1));
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi
  2016-11-30 22:42 ` [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi Eric Sandeen
@ 2016-12-01 12:15   ` Brian Foster
  2016-12-01 17:43   ` [PATCH 2/2 V2] " Eric Sandeen
  1 sibling, 0 replies; 8+ messages in thread
From: Brian Foster @ 2016-12-01 12:15 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

On Wed, Nov 30, 2016 at 04:42:50PM -0600, Eric Sandeen wrote:
> We've missed properly setting the buffer type for
> an AGI transaction in 3 spots now, so just move it
> into xfs_read_agi() and set it if we are in a transaction
> to avoid the problem in the future.
> 
> This is similar to how it is done in i.e. the dir3
> and attr3 read functions.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---

Looks like there's one more instance that can be removed in
xfs_iunlink(). Otherwise, looks good:

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

> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 51b4e0d..c482b97 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2450,8 +2450,6 @@
>  	ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
>  #endif
>  
> -	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_AGI_BUF);
> -
>  	/*
>  	 * Compute byte offsets for the first and last fields in the first
>  	 * region and log the agi buffer. This only logs up through
> @@ -2592,6 +2590,8 @@
>  			XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);
>  	if (error)
>  		return error;
> +	if (tp)
> +		xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_AGI_BUF);
>  
>  	xfs_buf_set_ref(*bpp, XFS_AGI_REF);
>  	return 0;
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 4e560e6..36e6372 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2133,7 +2133,6 @@
>  		agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
>  		offset = offsetof(xfs_agi_t, agi_unlinked) +
>  			(sizeof(xfs_agino_t) * bucket_index);
> -		xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
>  		xfs_trans_log_buf(tp, agibp, offset,
>  				  (offset + sizeof(xfs_agino_t) - 1));
>  	} else {
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 2d91f5a..9b3d7c7 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -4929,7 +4929,6 @@ static inline bool xlog_item_is_intent(struct xfs_log_item *lip)
>  	agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
>  	offset = offsetof(xfs_agi_t, agi_unlinked) +
>  		 (sizeof(xfs_agino_t) * bucket);
> -	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
>  	xfs_trans_log_buf(tp, agibp, offset,
>  			  (offset + sizeof(xfs_agino_t) - 1));
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2 V2] xfs: Move AGI buffer type setting to xfs_read_agi
  2016-11-30 22:42 ` [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi Eric Sandeen
  2016-12-01 12:15   ` Brian Foster
@ 2016-12-01 17:43   ` Eric Sandeen
  2016-12-02 13:16     ` Christoph Hellwig
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Sandeen @ 2016-12-01 17:43 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs

We've missed properly setting the buffer type for
an AGI transaction in 3 spots now, so just move it
into xfs_read_agi() and set it if we are in a transaction
to avoid the problem in the future.

This is similar to how it is done in i.e. the dir3
and attr3 read functions.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---

V2: oops, get all of them into the helper, thanks Brian.

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 51b4e0d..c482b97 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2450,8 +2450,6 @@
 	ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
 #endif
 
-	xfs_trans_buf_set_type(tp, bp, XFS_BLFT_AGI_BUF);
-
 	/*
 	 * Compute byte offsets for the first and last fields in the first
 	 * region and log the agi buffer. This only logs up through
@@ -2592,6 +2590,8 @@
 			XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);
 	if (error)
 		return error;
+	if (tp)
+		xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_AGI_BUF);
 
 	xfs_buf_set_ref(*bpp, XFS_AGI_REF);
 	return 0;
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 4e560e6..512ff13 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2041,7 +2041,6 @@
 	agi->agi_unlinked[bucket_index] = cpu_to_be32(agino);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		(sizeof(xfs_agino_t) * bucket_index);
-	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 	return 0;
@@ -2133,7 +2132,6 @@
 		agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
 		offset = offsetof(xfs_agi_t, agi_unlinked) +
 			(sizeof(xfs_agino_t) * bucket_index);
-		xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 		xfs_trans_log_buf(tp, agibp, offset,
 				  (offset + sizeof(xfs_agino_t) - 1));
 	} else {
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 2d91f5a..7cdef80 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -4929,7 +4931,6 @@ static inline bool xlog_item_is_intent(struct xfs_log_item *lip)
 	agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
 	offset = offsetof(xfs_agi_t, agi_unlinked) +
 		 (sizeof(xfs_agino_t) * bucket);
-	xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
 	xfs_trans_log_buf(tp, agibp, offset,
 			  (offset + sizeof(xfs_agino_t) - 1));
 


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

* Re: [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket
  2016-11-30 22:40 ` [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket Eric Sandeen
  2016-12-01 12:15   ` Brian Foster
@ 2016-12-02 13:15   ` Christoph Hellwig
  1 sibling, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2016-12-02 13:15 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

Looks good,

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

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

* Re: [PATCH 2/2 V2] xfs: Move AGI buffer type setting to xfs_read_agi
  2016-12-01 17:43   ` [PATCH 2/2 V2] " Eric Sandeen
@ 2016-12-02 13:16     ` Christoph Hellwig
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2016-12-02 13:16 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Eric Sandeen, linux-xfs

Looks good,

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

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

end of thread, other threads:[~2016-12-02 13:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-30 22:36 [PATCH 0/2] xfs: AGI buffer type handling Eric Sandeen
2016-11-30 22:40 ` [PATCH 1/2] xfs: set AGI buffer type in xlog_recover_clear_agi_bucket Eric Sandeen
2016-12-01 12:15   ` Brian Foster
2016-12-02 13:15   ` Christoph Hellwig
2016-11-30 22:42 ` [PATCH 2/2] xfs: Move AGI buffer type setting to xfs_read_agi Eric Sandeen
2016-12-01 12:15   ` Brian Foster
2016-12-01 17:43   ` [PATCH 2/2 V2] " Eric Sandeen
2016-12-02 13:16     ` 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).