Re: [PATCH] kernfs: implement custom llseek method to fix userspace regression
From: Valentin Sinitsyn
Date: Thu Aug 17 2023 - 14:54:48 EST
On 15.08.2023 20:48, Dan Williams wrote:
Valentin Sinitsyn wrote:
[..]
My only concern is whether there are any scenarios where this is not
appropriate. I.e. do a bit more work to define a kernfs_ops instance
specifically for overriding lseek() in this scenario.
Not sure I'm getting you here: do you mean something like this?
struct inode *inode = is_f_mapping_redefined(file) ? file_inode(file) :
file->f_mapping->host;
I meant something like the patch below (incomplete, but shows the idea).
Understood, thanks. I believe the change can be localized even further,
up to the point where battr->f_mapping is initialized with
iomem_get_mapping, as it is the only override known to break
generic_file_llseek().
I'll send the updated patch in a few days.
Best,
Valentin