Messages in this thread | | | Subject | Re: [RFC] sys_punchhole() | From | Badari Pulavarty <> | Date | Wed, 16 Nov 2005 08:05:06 -0800 |
| |
On Fri, 2005-11-11 at 06:18 +0100, Arjan van de Ven wrote: > On Thu, 2005-11-10 at 15:23 -0800, Badari Pulavarty wrote: > > > > We discussed this in madvise(REMOVE) thread - to add support > > for sys_punchhole(fd, offset, len) to complete the functionality > > (in the future). > > in the past always this was said to be "really hard" in linux locking > wise, esp. the locking with respect to truncate... > > did you find a solution to this problem ?
I have been thinking about some of the race condition we might run into. Its hard to think all of them, when I really don't have any code to play with :(
Anyway, I think race against truncate is fine. We hold i_alloc_sem - which should serialize against truncates. This should also serialize against DIO. Holding i_sem should take care of writers.
One concern I can think of is, racing with read(2). While we are thrashing pagecache and calling filesystem to free up the blocks - a read(2) could read old disk block and give old data (since it won't find it in pagecache). This could become a security hole :(
Thanks, Badari
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |