linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] xfs: fix trace_xfs_extlist calls
@ 2016-12-01 22:59 Eric Sandeen
  2016-12-01 23:06 ` [PATCH 1/2] xfs: pass state not whichfork to trace_xfs_extlist Eric Sandeen
  2016-12-01 23:08 ` [PATCH 2/2] xfs: handle cow fork in xfs_bmap_trace_exlist Eric Sandeen
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2016-12-01 22:59 UTC (permalink / raw)
  To: linux-xfs

the calls to trace_xfs_extlist() sent the wrong value for
the "state" variable, and did not handle the cow fork.  Fixing.

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

* [PATCH 1/2] xfs: pass state not whichfork to trace_xfs_extlist
  2016-12-01 22:59 [PATCH 0/2] xfs: fix trace_xfs_extlist calls Eric Sandeen
@ 2016-12-01 23:06 ` Eric Sandeen
  2016-12-02 13:12   ` Christoph Hellwig
  2016-12-01 23:08 ` [PATCH 2/2] xfs: handle cow fork in xfs_bmap_trace_exlist Eric Sandeen
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2016-12-01 23:06 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs

When xfs_bmap_trace_exlist called trace_xfs_extlist,
it sent in the "whichfork" var instead of the bmap "state"
as expected (even though state was already set up for this
purpose).

As a result, the xfs_bmap_class in tracing code used
"whichfork" not state in xfs_iext_state_to_fork(), and got
the wrong ifork pointer.  It all goes downhill from
there, including an ASSERT when ifp_bytes is empty
by the time it reaches xfs_iext_get_ext():

XFS: Assertion failed: idx < ifp->if_bytes / sizeof(xfs_bmbt_rec_t)

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

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index c27344c..b085f9b 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -517,7 +517,7 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
 	ifp = XFS_IFORK_PTR(ip, whichfork);
 	ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));
 	for (idx = 0; idx < cnt; idx++)
-		trace_xfs_extlist(ip, idx, whichfork, caller_ip);
+		trace_xfs_extlist(ip, idx, state, caller_ip);
 }
 
 /*



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

* [PATCH 2/2] xfs: handle cow fork in xfs_bmap_trace_exlist
  2016-12-01 22:59 [PATCH 0/2] xfs: fix trace_xfs_extlist calls Eric Sandeen
  2016-12-01 23:06 ` [PATCH 1/2] xfs: pass state not whichfork to trace_xfs_extlist Eric Sandeen
@ 2016-12-01 23:08 ` Eric Sandeen
  2016-12-02 13:13   ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2016-12-01 23:08 UTC (permalink / raw)
  To: Eric Sandeen, linux-xfs

By inspection, xfs_bmap_trace_exlist isn't handling cow forks,
and will trace the data fork instead.

Fix this by setting state appropriately if whichfork
== XFS_COW_FORK.

()___()
< @ @ >
 |   |      
 {o_o}
  (|)

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

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index b085f9b..93df173 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -504,7 +504,7 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
 xfs_bmap_trace_exlist(
 	xfs_inode_t	*ip,		/* incore inode pointer */
 	xfs_extnum_t	cnt,		/* count of entries in the list */
-	int		whichfork,	/* data or attr fork */
+	int		whichfork,	/* data or attr or cow fork */
 	unsigned long	caller_ip)
 {
 	xfs_extnum_t	idx;		/* extent record index */
@@ -513,6 +513,8 @@ static inline bool xfs_bmap_wants_extents(struct xfs_inode *ip, int whichfork)
 
 	if (whichfork == XFS_ATTR_FORK)
 		state |= BMAP_ATTRFORK;
+	else if (whichfork == XFS_COW_FORK)
+		state |= BMAP_COWFORK;
 
 	ifp = XFS_IFORK_PTR(ip, whichfork);
 	ASSERT(cnt == (ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t)));


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

* Re: [PATCH 1/2] xfs: pass state not whichfork to trace_xfs_extlist
  2016-12-01 23:06 ` [PATCH 1/2] xfs: pass state not whichfork to trace_xfs_extlist Eric Sandeen
@ 2016-12-02 13:12   ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-12-02 13:12 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] 5+ messages in thread

* Re: [PATCH 2/2] xfs: handle cow fork in xfs_bmap_trace_exlist
  2016-12-01 23:08 ` [PATCH 2/2] xfs: handle cow fork in xfs_bmap_trace_exlist Eric Sandeen
@ 2016-12-02 13:13   ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2016-12-02 13:13 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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 22:59 [PATCH 0/2] xfs: fix trace_xfs_extlist calls Eric Sandeen
2016-12-01 23:06 ` [PATCH 1/2] xfs: pass state not whichfork to trace_xfs_extlist Eric Sandeen
2016-12-02 13:12   ` Christoph Hellwig
2016-12-01 23:08 ` [PATCH 2/2] xfs: handle cow fork in xfs_bmap_trace_exlist Eric Sandeen
2016-12-02 13:13   ` 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).