On Tue 03-09-24 16:31:28, Christian Brauner wrote: > On Tue, Sep 03, 2024 at 03:50:55PM GMT, Jan Kara wrote: > > On Fri 30-08-24 15:04:59, Christian Brauner wrote: > > > Only regular files with FMODE_ATOMIC_POS and directories need > > > f_pos_lock. Place a new f_pipe member in a union with f_pos_lock > > > that they can use and make them stop abusing f_version in follow-up > > > patches. > > > > > > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> > > > > What makes me a bit uneasy is that we do mutex_init() on the space in > > struct file and then pipe_open() will clobber it. And then we eventually > > call mutex_destroy() on the clobbered mutex. I think so far this does no > > We don't call mutex_destroy() on it and don't need to. Ah, right, we don't bother with that for f_pos_lock. > And calling mutex_init() is fine precisely because pipes do use it. It > would be really ugly do ensure that mutex_init() isn't called for pipes. > But I'll add a comment. I'm not sure I understand what do you mean by "calling mutex_init() is fine precisely because pipes do use it." Perhaps you meant "don't use it"? Otherwise after looking at it for a while I agree the cure would be likely worse than the disease so a comment is as good as it gets I guess. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR