On Thu, 07 Aug 2025 03:55:22 +1000, Aleksa Sarai wrote:
Userspace generally expects APIs that return -EMSGSIZE to allow for them to adjust their buffer size and retry the operation. However, the fscontext log would previously clear the message even in the -EMSGSIZE case.
Given that it is very cheap for us to check whether the buffer is too small before we remove the message from the ring buffer, let's just do that instead. While we're at it, refactor some fscontext_read() into a separate helper to make the ring buffer logic a bit easier to read.
[...]
Applied to the vfs-6.18.mount branch of the vfs/vfs.git tree. Patches in the vfs-6.18.mount branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-6.18.mount
[1/2] fscontext: do not consume log entries when returning -EMSGSIZE https://git.kernel.org/vfs/vfs/c/b78c4328c498 [2/2] selftests/filesystems: add basic fscontext log tests https://git.kernel.org/vfs/vfs/c/d70b6ceebd29