xfs stats fixes
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 10 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstatfs/ | +1 | 6 replies | |
| 2/2 | xfs: Add new constant to mark start of xqmstatfs/ fs/ | +2 | 4 replies |
Reviews trailers per patch
1 of 2 patches has a Reviewed-by or Acked-by.
| Patch | Eric Sandeen |
|---|---|
| 1/2 | R-b |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] 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