On Wed, Feb 07, 2024 at 09:44:19PM +0000, Timur Tabi wrote: > On Thu, 2024-02-08 at 08:40 +1100, Dave Chinner wrote: > > i_size_write()? > > Thanks, I will post a v2. > > > > > And why doesn't debugfs_create_file_unsafe() do this already when it > > attaches the blob to the inode? > > Because it doesn't know the size any more. > > The 'blob' in debugfs_create_blob() is this: > > struct debugfs_blob_wrapper { > void *data; > unsigned long size; > }; > > When it passes the blob to debugfs_create_file_unsafe(), that's passed as > "void *data", and so debugfs_create_file_unsafe() doesn't know that it's a > 'blob' any more. So fix the debugfs_create_file_*() functions to pass a length and that way you fix all the "debugfs files have zero length but still have data that can be read" problems for everyone? Then the zero length problem can be isolated to just the debug objects that don't know their size (i.e. are streams of data, not fixed size). IMO, it doesn't help anyone to have one part of the debugfs blob/file API to set inode->i_size correctly, but then leave the majority of the users still behaving the problematic way (i.e. zero size yet with data that can be read). It's just a recipe for confusion.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx