[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100201223410.GB12882@ZenIV.linux.org.uk>
Date: Mon, 1 Feb 2010 22:34:10 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists