Re: [PATCH] fs: drop assert in file_seek_cur_needs_f_lock
From: Mateusz Guzik
Date: Thu Jun 12 2025 - 17:35:36 EST
On Thu, Jun 12, 2025 at 8:07 PM Luis Henriques <luis@xxxxxxxxxx> wrote:
> > I guess the commit message could be improved. Something like:
> >
> > The assert in function file_seek_cur_needs_f_lock() can be triggered very
> > easily because there are many users of vfs_llseek() (such as overlayfs)
> > that do their custom locking around llseek instead of relying on
> > fdget_pos(). Just drop the overzealous assertion.
>
> Thanks, makes more sense.
>
> Christian, do you prefer me to resend the patch or is it easier for you to
> just amend the commit? (Though, to be fair, the authorship could also be
> changed as I mostly reported the issue and tested!)
>
How about leaving a trace in the code.
For example a comment of this sort in place of the assert:
Note that we are not guaranteed to be called after fdget_pos() on this
file obj, in which case the caller is expected to provide the
appropriate locking.
I find it fishy af that a rando fs is playing games with the file obj
*and* the fact that games are played is not assertable, but at least
people can be warned.
--
Mateusz Guzik <mjguzik gmail.com>