Incomplete patch?
Incomplete patch?
Posted Mar 23, 2007 5:21 UTC (Fri) by ldo (guest, #40946)Parent article: fallocate()
It seems to me Amit Arora's patch is incomplete. It adds a new field to the inode_operations structure, but I can't see any code for initializing this field to any value. Presumably there are mandatory patches for all filesystems to at least set this field to NULL if they don't support this operation. Otherwise, an attempt to invoke this new system call could crash your system.
Posted Mar 23, 2007 9:56 UTC (Fri)
by khim (subscriber, #9252)
[Link] (3 responses)
I can't see any code for initializing this field to any value Have you looked at GCC sources ? That's where this code is, after all... P.S. Hint: what does C standard says about initialization of static and globar structures ?
Posted Mar 23, 2007 20:46 UTC (Fri)
by giraffedata (guest, #1954)
[Link] (2 responses)
No, it's not. It's in the filesystem drivers, in the statement that declares the inode_operations variables. Looking to GCC source code for the setting of this member to NULL is like looking at at GCC source code to see the setting of 'a' to 7 in a program that contains the line "int a = 7;"
An even better hint is that all the filesystem drivers (I hope) initialize the inode operations field by assigning from a static constant inode_operations variable. Because that's not obvious, and is essential to this patch working.
Posted Mar 26, 2007 17:44 UTC (Mon)
by shishir (subscriber, #20844)
[Link] (1 responses)
Posted Mar 27, 2007 15:50 UTC (Tue)
by giraffedata (guest, #1954)
[Link]
Incomplete patch?
Incomplete patch?
Have you looked at GCC sources ? That's where this code is, after all...
Hint: what does C standard says about initialization of static and globar structures ?
i guess this might be a case where we assume that if a filesystem does not explicitly initialise the field, it is NULL, as the system call code does check for this field to be non-NULL. If it is NULL, it returns -ENOSYS. So, I guess, you are right in saying that there are certain per-filesystem patches that need to be installed.Incomplete patch?
Incomplete patch?
I guess this might be a case where we assume that if a filesystem does not explicitly initialise the field, it is NULL, as the system call code does check for this field to be non-NULL. If it is NULL, it returns ->ENOSYS. So, I guess, you are right in saying that there are certain per-filesystem patches that need to be installed.
So you're saying that the assumption that if a filesystem driver does not explicitly initialize the field, it is NULL, is wrong? What makes you think that?