On Fri, Jul 20, 2007 at 01:53:16AM +0100, Al Viro wrote: > On Fri, Jul 20, 2007 at 10:45:34AM +1000, David Chinner wrote: > > On Thu, Jul 19, 2007 at 06:16:00PM -0400, Jan Harkes wrote: > > > On Thu, Jul 19, 2007 at 11:45:08PM +0200, Christoph Hellwig wrote: > > > > ->release is the proper way to detect the last close of a file, > > > > file_count should never be used in filesystems. > > > > > > Has been tried, the problem with that once ->release is called it is too > > > late to pass the the error back to close(2). > > > > I think you'll find the problem is that fput() throws away the error > > from ->release, not that it's too late.... > > Just where would that return value go? To the context that dropped the last reference. It can't be reported to anything else.... I'd much prefer to get an error on a file to any process that was using the file than have a potential indication of data or filesystem corruption silently dropped in the bit bucket..... > BTW, the reason why checks for struct file refcount blow is not far > from that: > > task A: write() > task B (sharing descriptor table with A): close() > task C (with another reference to struct file in question): close() > task A: return from write() > > Now, the final fput() here happens in write(). In particular, no > call of close(2) sees refcount equal to 1. Sure, but you've given no reason why the write() is unable to or should not return the error. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html