[lkml]   [2022]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/6] fs: do not set no_llseek in fops
On Fri, Jun 24, 2022 at 06:56:27PM +0200, Jason A. Donenfeld wrote:
> vfs_llseek already does something with this, and it makes it difficult
> to distinguish between llseek being supported and not.

How about something along the lines of

struct file_operations ->llseek() method gets called only in two places:
vfs_llseek() and dump_skip(). Both treat NULL and no_llseek as

The value of ->llseek is also examined in __full_proxy_fops_init() and
ovl_copy_up_data(). For the former we could as well treat no_llseek
as NULL; no need to do a proxy wrapper around the function that fails
with -ESPIPE without so much as looking at its arguments.
Same for the latter - there no_llseek would end up with skip_hole
set true until the first time we look at it. At that point we
call vfs_llseek(), observe that it has failed (-ESPIPE), shrug and
set skip_hole false. Might as well have done that from the very

In other words, any place where .llseek is set to no_llseek
could just as well set it to NULL.

for commit message?

Next commit would remove the checks for no_llseek and have vfs_llseek()
just do
if (file->f_mode & FMODE_LSEEK) {
if (file->f_op->llseek)
return file->f_op->llseek(file, offset, whence);
return -ESPIPE;
and kill no_llseek() off. And once you have guaranteed that FMODE_LSEEK
is never set with NULL ->llseek, vfs_llseek() gets trimmed in obvious
way and tests in dump_skip() and ovl_copy_up_data() would become simply
file->f_mode & FMODE_LSEEK - no need to check ->f_op->llseek there
after that. At the same time dump_skip() could switch to calling
vfs_llseek() instead of direct method call...

 \ /
  Last update: 2022-06-24 23:50    [W:0.147 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site