Bug 22857 - vfs.do_mpage_readpage doesn't work as expected on ext4 filesystems
Summary: vfs.do_mpage_readpage doesn't work as expected on ext4 filesystems
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: tapsets (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: David Smith
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-18 05:50 UTC by Evan Klitzke
Modified: 2018-03-31 12:32 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
proposed patch (1.10 KB, patch)
2018-02-23 19:17 UTC, David Smith
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Klitzke 2018-02-18 05:50:20 UTC
The VFS tapset defines vfs.do_mpage_readpage which probes the kernel function of the same name. This probe point would typically be used by Systemtap scripts that want to collect information about disk activity occurring as the result of accessing data in an mmaped file.

However, ext4 specializes this behavior, and provides its own ext4_mpage_readpages method which is used in the same context (i.e. when submitting bio requests for filed-backed mmap pages), and the Systemtap VFS tapset doesn't probe this. This means that vfs.do_mpage_readpage is effectively broken for a large percentage of Linux users.

This is a little bit trick to fix because these two methods have different interfaces. I think it might be possible to refactor the Linux code for ext4_mpage_readpages to call a do_ method that has the same type signature as do_mpage_readpage, but that would require a change to the Linux kernel. In the meantime it might make sense to add a new vfs probe point just for ext4_mpage_readpages.
Comment 1 David Smith 2018-02-23 19:17:08 UTC
Created attachment 10847 [details]
proposed patch

Here's a patch where I try to hook ext4_mpage_readpages() into the vfs.do_mpage_readpage probe alias. It compiles, but I haven't really tested it.

Can you test it and let me know if it works for you?
Comment 2 Evan Klitzke 2018-03-03 00:52:10 UTC
I was able to test your patch, and it seems to fix the issue.
Comment 3 David Smith 2018-03-05 16:44:02 UTC
(In reply to Evan Klitzke from comment #2)
> I was able to test your patch, and it seems to fix the issue.

Thanks for doing the testing. I've checked it in upstream as commit 89a7c8506.