fstrim on nvme / AMD CPU fails and produces kernel error messages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Connor Kuehl | ||
Disco |
Won't Fix
|
Medium
|
Connor Kuehl | ||
Eoan |
Fix Released
|
Medium
|
Connor Kuehl |
Bug Description
[Impact]
Discard requests can fail on a non-compliant nvme device meaning that prescribed maintenance use of fstrim will be unsuccessful and unused blocks are no longer properly disposed of.
[Test case]
Run fstrim (from bug report, ran as root: fstrim -v /)
Expected result: "/: 758.3 GiB (814159003648 bytes) trimmed" -- will vary depending on the blocks that are unused for your system
Unpatched actual result: "fstrim: /: FITRIM ioctl failed: Input/output error"
[Regression Potential]
This patch only increases the size of a memory allocation and does not add any changes in logic for error handling or normal flow of control. This routine already handles the case where the memory allocation fails. Because of this, it is a low risk change.
Original bug description below:
-------
/dev/nvme0n1 Sabrent Rocket 4.0 1TB firmware RKT401.1
on Ubuntu 19.10 with an ASRock 300 Deskmini motherboard and a Ryzen 3400G CPU. The filesystem is ext4:
Linux elemental 5.3.0-24-generic #26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
UUID=c1812230-
/dev/nvme0n1p2 on / type ext4 (rw,relatime)
When I run fstrim -v / as root, I get the following error message at the command line:
seth@elemental:~$ sudo fstrim -v /
fstrim: /: FITRIM ioctl failed: Input/output error
and the following kernel messages are logged:
[ 136.309115] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x0 flags=0x0000]
[ 136.309129] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x700 flags=0x0000]
[ 136.309139] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x680 flags=0x0000]
[ 136.309150] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x300 flags=0x0000]
[ 136.309162] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x200 flags=0x0000]
[ 136.309171] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x580 flags=0x0000]
[ 136.309180] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x100 flags=0x0000]
[ 136.309189] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x400 flags=0x0000]
[ 136.309198] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x380 flags=0x0000]
[ 136.309207] nvme 0000:01:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0000 address=0x780 flags=0x0000]
[ 136.309216] amd_iommu_
[ 136.309218] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x180 flags=0x0000]
[ 136.309228] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x500 flags=0x0000]
[ 136.309238] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x480 flags=0x0000]
[ 136.309250] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x280 flags=0x0000]
[ 136.309259] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x600 flags=0x0000]
[ 136.309269] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x80 flags=0x0000]
[ 136.309279] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x980 flags=0x0000]
[ 136.309291] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x900 flags=0x0000]
[ 136.309301] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0x880 flags=0x0000]
[ 136.309311] AMD-Vi: Event logged [IO_PAGE_FAULT device=01:00.0 domain=0x0000 address=0xa00 flags=0x0000]
[ 136.309762] blk_update_request: I/O error, dev nvme0n1, sector 1141976 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0
I have tried setting iommu passthrough on boot but this doesn’t seem to help:
GRUB_CMDLINE_
This is possibly related to:
https:/
http://
CVE References
Changed in linux (Ubuntu): | |
status: | New → Invalid |
Changed in linux (Ubuntu Eoan): | |
status: | New → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → Connor Kuehl (connork) |
no longer affects: | fstrim (Ubuntu Eoan) |
no longer affects: | fstrim (Ubuntu) |
Changed in linux (Ubuntu Xenial): | |
status: | New → In Progress |
Changed in linux (Ubuntu Bionic): | |
status: | New → In Progress |
Changed in linux (Ubuntu Disco): | |
status: | New → In Progress |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Bionic): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in linux (Ubuntu Bionic): | |
assignee: | nobody → Connor Kuehl (connork) |
Changed in linux (Ubuntu Disco): | |
assignee: | nobody → Connor Kuehl (connork) |
Changed in linux (Ubuntu Xenial): | |
assignee: | nobody → Connor Kuehl (connork) |
no longer affects: | fstrim (Ubuntu Xenial) |
no longer affects: | fstrim (Ubuntu Bionic) |
no longer affects: | fstrim (Ubuntu Disco) |
Changed in linux (Ubuntu Bionic): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Disco): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Eoan): | |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Disco): | |
status: | Fix Committed → Won't Fix |
Update: I built a 5.3.10 kernel with the patch suggested in the infradead link (patch located at http:// git.infradead. org/nvme. git/patch/ 530436c45ef2e44 6c12538a400e465 929a0b3ade? hp=400b6a7b13a3 fd71cff087139ce 45dd1e5fff444) and the errors went away; fstrim is working properly:
seth@elemental:~$ sudo fstrim -v /
/: 758.3 GiB (814159003648 bytes) trimmed
and no kernel errors.
Could this be merged soon? Thank you.