On Tue, Nov 14, 2023 at 05:57:14PM +0000, Al Viro wrote: > On Tue, Nov 14, 2023 at 06:29:15PM +0100, Christian Brauner wrote: > > > I think it's usually best practice to only modify the file->private_data > > pointer during f_op->open and f_op->close but not override > > file->private_data once the file is visible to other threads. I think > > here it might not matter because access to file->private_data is > > serialized on f_pos_lock and it's not used by anything else. > > That is entirely up to filesystem. Warning that use of that library > helper means that you can't use your ->d_fsdata for anything else - sure, > but that's it. Yes, but it's usually easier to reason about if the pointer just changes during open/close. Nothing I wrote said that it's mandated just so I'm clear.