Skip to contentSkip to conversation

xfs stats fixes

PATCH In review Carlos Maiolino 4 participants 13 messages Oct 3, 2018 – Oct 4, 2018 XFS filesystem

lore
Share & tools
lore
#0 lore raw

cover xfs stats fixes

Hi,

this week I found a bug in the code for xqmstat file in procfs, caused by wrong offsets while reading the __xfsstats structure fields in xqmstat_proc_show.

This patchset aims to fix the bug (patch 1) and add a way to reduce the likelyhood of creating the same error again.

xqmstat_proc_show() uses a loop to walk through the quota-specific fields in __xfsstats when printing the information. The problem is, since the start/end offsets are hardcoded, any update to __xfsstats may also require an update on the start offset in xqmstat_proc_show().

I decided to split it into two patches, because I think it is easier to let the bugfix itself in a separated patch, and the approach on how to avoid it in the future can be discussed in a separated patch.

My first idea was to try to add a method to check it at compile time, and I spent some time discussing with Eric what would be the best way to avoid this problem in the future.
We end up with an possible solution using offsetof() and a new constant in xfs_stats.h to properly check the offsets at compile time.
Although, after giving it some extra thought, I found it better to only use a new constant to mark the start of xqmstat in xfs_stats.h and not add any fancy calculation in xqmstat_proc_show itself.
History told me that all updates to __xfsstats and its respective content/uses, were properly done when needed, only the xqmstat was left behind because it's unusual direct usage of the offset markers. So, I believe that the addition of a new marker to specify the start offset of the quota stat fields is enough to avoid future problems here, once no more changes will be needed in xqmstat code whenever __xfsstats requires to be updated.

My idea though is still to move this file to sysfs together with the rest of statistic code, but by now, I believe we should fix this bug.

Comments?

Cheers.

Carlos Maiolino (2):
xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat
xfs: Add new constant to mark start of xqmstat

 fs/xfs/xfs_stats.c | 2 +-
 fs/xfs/xfs_stats.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Fix it.

---
 fs/xfs/xfs_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
index 4e4423153071..740ac9674848 100644
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_IBT_V2; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
Signature · 1 line
2.17.1
#8 lore raw

PATCH 2/2 xfs: Add new constant to mark start of xqmstat

In reply to Carlos Maiolino

xqmstat information under __xfsstats is used directly by the /proc/fs/xfs/xqmstat show method, which makes use of struct offsets to print out the values.

Currently, the function is setup to start printing values from the offset of the last marker before xqmstat, so, an update to __xfsstats structure may also require an update of xqmstat_proc_show() function.

By adding a new constant, we concentrate any updates do __xfsstats structure fields locally to the file xfs_stats.h, reducing the likelyhood of future bugs if an update to xqmstat_proc_show is forgotten as have happened before.

---
 fs/xfs/xfs_stats.c | 2 +-
 fs/xfs/xfs_stats.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
index 740ac9674848..09121c36a062 100644
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_START_XQMSTAT; j < XFSSTAT_END_XQMSTAT; j++)
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
fs/xfs/xfs_stats.h +1 -0
index 130db070e4d8..102e794addac 100644
@@ -147,6 +147,7 @@ struct __xfsstats {
 	uint32_t		xs_rmap_2[__XBTS_MAX];
 #define XFSSTAT_END_REFCOUNT		(XFSSTAT_END_RMAP_V2 + __XBTS_MAX)
 	uint32_t		xs_refcbt_2[__XBTS_MAX];
+#define XFSSTAT_START_XQMSTAT		XFSSTAT_END_REFCOUNT
 #define XFSSTAT_END_XQMSTAT		(XFSSTAT_END_REFCOUNT + 6)
 	uint32_t		xs_qm_dqreclaims;
 	uint32_t		xs_qm_dqreclaim_misses;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

In reply to Carlos Maiolino
Quoted 5 lines · Carlos Maiolino

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Well, it caused /proc/fs/xfs/xqmstat to display garbage data, right? That seems worth highlighting in the changelog, and not glossing over.

Could maybe use Fixes: tags for:

00f4e4f9 xfs: add rmap btree stats infrastructure aafc3c24 xfs: support the XFS_BTNUM_FINOBT free inode btree type 46eeb521 xfs: introduce refcount btree definitions

and a stable tag as well? Though stable is tricky because different patches would be required for different points along the stats structure evolution... maybe best to ignore it, chances of auto-applying it correctly are slim to none.

As for the change itself,

Quoted 21 lines

Fix it.

---
 fs/xfs/xfs_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
index 4e4423153071..740ac9674848 100644
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_IBT_V2; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
#9 lore raw

Re: [PATCH 2/2] xfs: Add new constant to mark start of xqmstat

In reply to Carlos Maiolino
Quoted 4 lines · Carlos Maiolino

xqmstat information under __xfsstats is used directly by the /proc/fs/xfs/xqmstat show method, which makes use of struct offsets to print out the values.

Quoted 8 lines

Currently, the function is setup to start printing values from the offset of the last marker before xqmstat, so, an update to __xfsstats structure may also require an update of xqmstat_proc_show() function.

By adding a new constant, we concentrate any updates do __xfsstats structure fields locally to the file xfs_stats.h, reducing the likelyhood of future bugs if an update to xqmstat_proc_show is forgotten as have happened before.

did

BUILD_BUG_ON(offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t)) != XFSSTAT_START_XQMSTAT);

and/or

#define XFSSTAT_START_XQMSTAT (offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t))

not work out?

Quoted 32 lines
---
 fs/xfs/xfs_stats.c | 2 +-
 fs/xfs/xfs_stats.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
index 740ac9674848..09121c36a062 100644
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_START_XQMSTAT; j < XFSSTAT_END_XQMSTAT; j++)
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
fs/xfs/xfs_stats.h +1 -0
index 130db070e4d8..102e794addac 100644
@@ -147,6 +147,7 @@ struct __xfsstats {
 	uint32_t		xs_rmap_2[__XBTS_MAX];
 #define XFSSTAT_END_REFCOUNT		(XFSSTAT_END_RMAP_V2 + __XBTS_MAX)
 	uint32_t		xs_refcbt_2[__XBTS_MAX];
+#define XFSSTAT_START_XQMSTAT		XFSSTAT_END_REFCOUNT
 #define XFSSTAT_END_XQMSTAT		(XFSSTAT_END_REFCOUNT + 6)
 	uint32_t		xs_qm_dqreclaims;
 	uint32_t		xs_qm_dqreclaim_misses;
#3 lore raw

Re: [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

In reply to Eric Sandeen
Quoted 9 lines · Eric Sandeen
Quoted 5 lines · Carlos Maiolino

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Well, it caused /proc/fs/xfs/xqmstat to display garbage data, right? That seems worth highlighting in the changelog, and not glossing over.

Well, I wouldn't say 'garbage' data. I'd say data from other fields in the structure (at this point, specifically fino btree data) :P, but sure, I can add it to the changelog.

Quoted 7 lines

Could maybe use Fixes: tags for:

00f4e4f9 xfs: add rmap btree stats infrastructure aafc3c24 xfs: support the XFS_BTNUM_FINOBT free inode btree type 46eeb521 xfs: introduce refcount btree definitions

No objection.

Quoted 4 lines

and a stable tag as well? Though stable is tricky because different patches would be required for different points along the stats structure evolution... maybe best to ignore it, chances of auto-applying it correctly are slim to none.

Indeed, this may not apply to stable trees, unless the tree itself contains all three data structures (rmap finobtree and refcount).

Quoted 28 lines

As for the change itself,

Quoted 21 lines

Fix it.

---
 fs/xfs/xfs_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
index 4e4423153071..740ac9674848 100644
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_IBT_V2; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
Signature · 1 line
Carlos
#4 lore raw

Re: [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

Quoted 8 lines · Carlos Maiolino
Quoted 7 lines · Eric Sandeen
Quoted 5 lines · Carlos Maiolino

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Quoted 6 lines
Quoted 2 lines

Well, it caused /proc/fs/xfs/xqmstat to display garbage data, right? That seems worth highlighting in the changelog, and not glossing over.

Well, I wouldn't say 'garbage' data. I'd say data from other fields in the structure (at this point, specifically fino btree data) :P, but sure, I can add it to the changelog.

That's kind of like saying stale data exposure or kernel memory leaks isn't garbage data, it's just someone /else's/ data. ;)

Anyway, however you want to phrase it, aI think the change needs to highlight that there /is/ a failure and it's not an irrelevant fix.

Quoted 10 lines
Quoted 7 lines

Could maybe use Fixes: tags for:

00f4e4f9 xfs: add rmap btree stats infrastructure aafc3c24 xfs: support the XFS_BTNUM_FINOBT free inode btree type 46eeb521 xfs: introduce refcount btree definitions

No objection.

Quoted 7 lines
Quoted 4 lines

and a stable tag as well? Though stable is tricky because different patches would be required for different points along the stats structure evolution... maybe best to ignore it, chances of auto-applying it correctly are slim to none.

Indeed, this may not apply to stable trees, unless the tree itself contains all three data structures (rmap finobtree and refcount).

Yeah. It would go back to 4.10 cleanly, tho. Just a thought.

-Eric

#10 lore raw

Re: [PATCH 2/2] xfs: Add new constant to mark start of xqmstat

In reply to Eric Sandeen
Quoted 14 lines · Eric Sandeen
Quoted 4 lines · Carlos Maiolino

xqmstat information under __xfsstats is used directly by the /proc/fs/xfs/xqmstat show method, which makes use of struct offsets to print out the values.

Quoted 8 lines

Currently, the function is setup to start printing values from the offset of the last marker before xqmstat, so, an update to __xfsstats structure may also require an update of xqmstat_proc_show() function.

By adding a new constant, we concentrate any updates do __xfsstats structure fields locally to the file xfs_stats.h, reducing the likelyhood of future bugs if an update to xqmstat_proc_show is forgotten as have happened before.

Quoted 7 lines

did

BUILD_BUG_ON(offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t)) != XFSSTAT_START_XQMSTAT);

and/or

#define XFSSTAT_START_XQMSTAT (offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t))

Yup, it worked, although, it still doesn't really close the possibility for mistakes here, the first field may change for example and we may end up in the same situation.

I think only the 2nd option (defining START via offsetof), doesn't differ much from the approach in the patch, and, using the 1st option (BUILD_BUG_ON), will require an update to xqmstat_proc_show() if by any reason we change the quota values, so, I thought the simpler version as the patch would suffice and be a bit less confusing. But well, feel free to disagree, it's my opinion only and not written on stone :P

Quoted 35 lines

not work out?

Quoted 32 lines
---
 fs/xfs/xfs_stats.c | 2 +-
 fs/xfs/xfs_stats.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
index 740ac9674848..09121c36a062 100644
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_START_XQMSTAT; j < XFSSTAT_END_XQMSTAT; j++)
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
fs/xfs/xfs_stats.h +1 -0
index 130db070e4d8..102e794addac 100644
@@ -147,6 +147,7 @@ struct __xfsstats {
 	uint32_t		xs_rmap_2[__XBTS_MAX];
 #define XFSSTAT_END_REFCOUNT		(XFSSTAT_END_RMAP_V2 + __XBTS_MAX)
 	uint32_t		xs_refcbt_2[__XBTS_MAX];
+#define XFSSTAT_START_XQMSTAT		XFSSTAT_END_REFCOUNT
 #define XFSSTAT_END_XQMSTAT		(XFSSTAT_END_REFCOUNT + 6)
 	uint32_t		xs_qm_dqreclaims;
 	uint32_t		xs_qm_dqreclaim_misses;
Signature · 1 line
Carlos
#11 lore raw

Re: [PATCH 2/2] xfs: Add new constant to mark start of xqmstat

Quoted 27 lines · Carlos Maiolino
Quoted 14 lines · Eric Sandeen
Quoted 4 lines · Carlos Maiolino

xqmstat information under __xfsstats is used directly by the /proc/fs/xfs/xqmstat show method, which makes use of struct offsets to print out the values.

Quoted 8 lines

Currently, the function is setup to start printing values from the offset of the last marker before xqmstat, so, an update to __xfsstats structure may also require an update of xqmstat_proc_show() function.

By adding a new constant, we concentrate any updates do __xfsstats structure fields locally to the file xfs_stats.h, reducing the likelyhood of future bugs if an update to xqmstat_proc_show is forgotten as have happened before.

Quoted 7 lines

did

BUILD_BUG_ON(offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t)) != XFSSTAT_START_XQMSTAT);

and/or

#define XFSSTAT_START_XQMSTAT (offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t))

Yup, it worked, although, it still doesn't really close the possibility for mistakes here, the first field may change for example and we may end up in the same situation.

Quoted 6 lines

I think only the 2nd option (defining START via offsetof), doesn't differ much from the approach in the patch, and, using the 1st option (BUILD_BUG_ON), will require an update to xqmstat_proc_show() if by any reason we change the quota values, so, I thought the simpler version as the patch would suffice and be a bit less confusing. But well, feel free to disagree, it's my opinion only and not written on stone :P

I'd argue that the first field of xqmstats changing not possible, because this is essentially a userspacce API. If we're going to change the format of xqmstats, we should only add to the end of it.

The thing about using offsetof() is that we'll never have to update the START define again, even if we add more records to the larger stats structure.

But we can see what others think as well.

-Eric

#6 lore raw

Re: [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

In reply to Carlos Maiolino
Quoted 18 lines · Carlos Maiolino

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Fix it.

---
 fs/xfs/xfs_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_stats.c +0 -0
index 4e4423153071..740ac9674848 100644

fs/xfs/xfs_stats.c static int xqmstat_proc_show(struct seq_file *m, void *v) · line 122

Quoted 5 lines
fs/xfs/xfs_stats.c +1 -1
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_IBT_V2; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)

/me totally missed that when I was writing reflink, sorry. :(

Can we have a:

  #define XFSSTAT_START_XQMSTAT (XFSSTAT_END_REFCOUNT)

in xfs_stats.h right above the XFSSTAT_END_XQMSTAT definition so that future authors don't have to remember that some code use _END_REFCOUNT to mean "start of next thing"?

--D

Quoted 6 lines
fs/xfs/xfs_stats.c +0 -0
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
Signature · 1 line
2.17.1
#7 lore raw

Re: [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

Quoted 27 lines · Darrick J. Wong
Quoted 18 lines · Carlos Maiolino

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Fix it.

---
 fs/xfs/xfs_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_stats.c +0 -0
index 4e4423153071..740ac9674848 100644

fs/xfs/xfs_stats.c static int xqmstat_proc_show(struct seq_file *m, void *v) · line 122

Quoted 5 lines
fs/xfs/xfs_stats.c +1 -1
@@ -119,7 +119,7 @@ static int xqmstat_proc_show(struct seq_file *m, void *v)
 	int j;
 
 	seq_printf(m, "qm");
-	for (j = XFSSTAT_END_IBT_V2; j < XFSSTAT_END_XQMSTAT; j++)
+	for (j = XFSSTAT_END_REFCOUNT; j < XFSSTAT_END_XQMSTAT; j++)

/me totally missed that when I was writing reflink, sorry. :(

Quoted 7 lines

Can we have a:

  #define XFSSTAT_START_XQMSTAT (XFSSTAT_END_REFCOUNT)

in xfs_stats.h right above the XFSSTAT_END_XQMSTAT definition so that future authors don't have to remember that some code use _END_REFCOUNT to mean "start of next thing"?

Oh, that is patch 2. Sorry, disregard message.

Quoted 8 lines

--D

Quoted 6 lines
fs/xfs/xfs_stats.c +0 -0
 		seq_printf(m, " %u", counter_val(xfsstats.xs_stats, j));
 	seq_putc(m, '\n');
 	return 0;
Signature · 1 line
2.17.1
#12 lore raw

Re: [PATCH 2/2] xfs: Add new constant to mark start of xqmstat

In reply to Eric Sandeen
Quoted 37 lines · Eric Sandeen
Quoted 27 lines · Carlos Maiolino
Quoted 14 lines · Eric Sandeen
Quoted 4 lines · Carlos Maiolino

xqmstat information under __xfsstats is used directly by the /proc/fs/xfs/xqmstat show method, which makes use of struct offsets to print out the values.

Quoted 8 lines

Currently, the function is setup to start printing values from the offset of the last marker before xqmstat, so, an update to __xfsstats structure may also require an update of xqmstat_proc_show() function.

By adding a new constant, we concentrate any updates do __xfsstats structure fields locally to the file xfs_stats.h, reducing the likelyhood of future bugs if an update to xqmstat_proc_show is forgotten as have happened before.

Quoted 7 lines

did

BUILD_BUG_ON(offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t)) != XFSSTAT_START_XQMSTAT);

and/or

#define XFSSTAT_START_XQMSTAT (offsetof(struct __xfsstats, xs_qm_dqreclaims)/sizeof(uint32_t))

Yup, it worked, although, it still doesn't really close the possibility for mistakes here, the first field may change for example and we may end up in the same situation.

Quoted 6 lines

I think only the 2nd option (defining START via offsetof), doesn't differ much from the approach in the patch, and, using the 1st option (BUILD_BUG_ON), will require an update to xqmstat_proc_show() if by any reason we change the quota values, so, I thought the simpler version as the patch would suffice and be a bit less confusing. But well, feel free to disagree, it's my opinion only and not written on stone :P

Quoted 3 lines

I'd argue that the first field of xqmstats changing not possible, because this is essentially a userspacce API. If we're going to change the format of xqmstats, we should only add to the end of it.

That's correct. Once published, the stats in each line are fixed in place forever. We can extend the stats by appending new stats to the end of each line, or by adding new lines. But we can't change the order or meaning of existing entries.

Quoted 2 lines

The thing about using offsetof() is that we'll never have to update the START define again, even if we add more records to the larger stats structure.

I think the whole thing needs to be changed to use offsetof() rather than the messy set of cascading defines we have now.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#5 lore raw

Re: [PATCH 1/2] xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat

In reply to Eric Sandeen
Quoted 16 lines · Eric Sandeen
Quoted 8 lines · Carlos Maiolino
Quoted 7 lines · Eric Sandeen
Quoted 5 lines · Carlos Maiolino

The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.

Although this didn't cause any direct issue, xqmstat_proc_show() relied on the old offsets to display the xqm statistics.

Quoted 6 lines
Quoted 2 lines

Well, it caused /proc/fs/xfs/xqmstat to display garbage data, right? That seems worth highlighting in the changelog, and not glossing over.

Well, I wouldn't say 'garbage' data. I'd say data from other fields in the structure (at this point, specifically fino btree data) :P, but sure, I can add it to the changelog.

Quoted 6 lines

That's kind of like saying stale data exposure or kernel memory leaks isn't garbage data, it's just someone /else's/ data. ;)

Anyway, however you want to phrase it, aI think the change needs to highlight that there /is/ a failure and it's not an irrelevant fix.

Sure, I'll resubmit the patch again with updated description together with a new version of patch 2, I am considering to do what Dave suggested and replace the defines by offsetof() macros, but well, will see.

I'll add your reviewed-by flag to the patch 1, is it ok? I think that's what you meant with your previous reply?

Quoted 15 lines
Quoted 15 lines
Quoted 7 lines

Could maybe use Fixes: tags for:

00f4e4f9 xfs: add rmap btree stats infrastructure aafc3c24 xfs: support the XFS_BTNUM_FINOBT free inode btree type 46eeb521 xfs: introduce refcount btree definitions

No objection.

Quoted 4 lines

and a stable tag as well? Though stable is tricky because different patches would be required for different points along the stats structure evolution... maybe best to ignore it, chances of auto-applying it correctly are slim to none.

Quoted 4 lines
Quoted 2 lines

Indeed, this may not apply to stable trees, unless the tree itself contains all three data structures (rmap finobtree and refcount).

Yeah. It would go back to 4.10 cleanly, tho. Just a thought.

Ok,
Cheers

Quoted 2 lines

-Eric

Signature · 1 line
Carlos