Re: [PATCH 2/6] fs: do not set no_llseek in fops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 24, 2022 at 10:48:40PM +0100, Al Viro wrote:
> 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
> equivalent.
> 
> 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
> beginning.
> 
> 	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...

Thanks. I'll split things into steps more or less like that and borrow
that commit text for v2 (which I'll send out somewhat soon).

Jason



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux