Bad file access on the rise

Matthew Garrett mjg59 at srcf.ucam.org
Sun Jun 9 15:42:46 UTC 2013


On Sun, Jun 09, 2013 at 11:05:44AM -0400, Doug Ledford wrote:

> And really, we've spent more time on this thread than it would take
> Lennart to fix PA.  Just a quick stat and check of uid before trying to
> remove the stale files and this would all go away.  Sure, your stat and
> remove could race, but this is nothing more than a garbage collection
> process anyway, so who cares?  We'll just get it next time.

"Stat and then open" is inherently open to race conditions. In this 
specific case it probably doesn't realistically matter, but it's not 
behaviour that should be encouraged. The only way to know for certain 
whether you're going to be able to open or unlink a file is to attempt 
to open or unlink that file, and we shouldn't encourage people to think 
otherwise.

-- 
Matthew Garrett | mjg59 at srcf.ucam.org


More information about the devel mailing list