f2fs with Android story is always complicated.
So why is SuperSU broken with many custom ROMs:
systemless SuperSU saves a raw ext4 image in /data/su.img and mounts it as a loopback device and to various locations upon boot.
The problem with f2fs, is that most kernels included in custom ROMs have issues with managing loopback devices.
This is not SuperSU issue, rather, kernel developers has to incorporate the necessary fix for f2fs.
This “fix” is rather dumb :
https://git.kernel.org/cgit/linux/k...y&id=0d5ed69805ee57d7b416c4a6b47c3b67284db105
The f2fs head, Kim Jaegeuk forgot to add those pointer to post-4.10 versions of f2fs backports.
(The stock OnePlus 3T’s kernel source code seems to already have this fix. This explains why OxygenOS didn’t have any issues with SuperSU.)
So you have 2 choices :
A. Cherry-pick that fix separately
B. Merge f2fs version all the way up to 4.10(latest f2fs-stable.git is updated to 4.10)
But there are more stories to be told, unfortunately.
Both 2 methods introduce a new problem : breaks all previous f2fs versions to read the data.
There is no on-disk-format change introduced by the new “fix”, but it turns out that older versions of f2fs has an issue which is exploited only when newer version of f2fs is used to write data.
You need this additional fix, if you have no intention to update f2fs to the latest 4.10 version :
https://git.kernel.org/cgit/linux/k...y&id=7a895023cc2c06c08a6cccb71e112255eb0837ee
Without this fix, the kernel will panic upon reading any data.
So we took care of the method A.
However, there is still an issue with method B : deadlock.
As noted in
https://review.lineageos.org/#/c/95316/ , there are deadlocks present on the latest version of f2fs(from 4.8, iirc).
It took about a month to bisect it, and I got the culprit commit :
https://git.kernel.org/cgit/linux/k...y&id=de62dad6f502c67fd01b5c0b1f7f242836ce90d0
I’m still yet to hear from the upstream developers, but I can confirm that reverting that commit fixes the deadlock.
Our internal AOSPA builds are running on 4.10 f2fs with that commit reverted.
TL;DR
It’s not @Chainfire 's fault.
You have to ask the kernel developer to fix the issue.
2 methods for the kernel developers
A. Incorporate only the necessary 2 fixes to fix loopback images :
https://git.kernel.org/cgit/linux/k...y&id=0d5ed69805ee57d7b416c4a6b47c3b67284db105
https://git.kernel.org/cgit/linux/k...y&id=7a895023cc2c06c08a6cccb71e112255eb0837ee
B. If you want to upstream f2fs to the latest 4.10, revert this to avoid deadlock :
https://git.kernel.org/cgit/linux/k...y&id=de62dad6f502c67fd01b5c0b1f7f242836ce90d0
(A little credit would be appreciated, as it took me a frustrating month to bisect this)
Thanks.