Messages in this thread | | | Date | Mon, 1 Feb 2010 22:34:10 +0000 | From | Al Viro <> | Subject | Re: [PATCH][RFC] %pd - for printing dentry name |
| |
On Mon, Feb 01, 2010 at 10:25:11PM +0000, Al Viro wrote: > There's a lot of places doing printks with ->d_name of various > dentries. Unfortunately, as often as not they are b0rken due to races > with rename(). > > I propose to add a new format - %pd. It would print dentry name. > However, unlike everything else in vsnprintf, it would NOT be locking-agnostic. > It would grab and release dentry->d_lock. And yes, I hate that as much as > anyone. I don't see any sane alternative. > > Patch below implements it and fixes some obvious races in ocfs2 > and ubifs by switch to that sucker. There are many more places of > that kind and a _lot_ of those are racy. Adding ->d_lock in every caller > is not a good solution, IMO... > > Rules are: > * don't use %pd under dentry->d_lock, use dentry->d_name.name instead; in > that case it *is* safe. Incidentally, ->d_lock isn't held a lot. > * if we don't hold dentry->d_lock, feel free to use %pd....,dentry > > Comments?
PS: if it ends up going in, the usual S-o-b applies
| |