All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH][RFC] %pd - for printing dentry name
Date: Mon, 1 Feb 2010 20:22:24 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1002012018400.3664@localhost.localdomain> (raw)
In-Reply-To: <20100201231847.GC12882@ZenIV.linux.org.uk>



On Mon, 1 Feb 2010, Al Viro wrote:
> 
> Ehh...  RCU will save you from stepping on freed memory, but it still will
> leave the joy of half-updated string with length out of sync with it, etc.

Sure. But do we care?

Every printk _should_ be on a dentry that we have a reference to, anyway. 
Otherwise, how did we find it?

So yeah, then there is the race with rename(), but (a) it's not going to 
happen, (b) if we race with rename there is no "one" correct solution 
anyway, so (c) what we really want to protect against is the printk 
causing problems (like an oops from DEBUG_PAGEALLOC and freeing the old 
name).

> We probably can get away with that, but we'll have to be a lot more careful
> with the order of updating these suckers in d_move_locked et.al.

I wouldn't worry about it too much. So what if we get a screwed up name? 
If we use "%.*s" to print the name, we know that we won't overstep the old 
name even if the NUL termination somehow went away (because we're busy 
copying a new, longer, name over it or whatever).

So I would not worry too much about sometimes showing a nonsensical name 
that may be the result of a concurrent rename. I'd only worry about it not 
oopsing or stepping on memory that hasn't had _either_ the old or the new 
name in it.

That's why I think an RCU solution should be sufficient..

			Linus

  parent reply	other threads:[~2010-02-02  4:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 22:25 [PATCH][RFC] %pd - for printing dentry name Al Viro
2010-02-01 22:34 ` Al Viro
2010-02-01 22:37 ` Linus Torvalds
2010-02-01 23:18   ` Al Viro
2010-02-02  1:06     ` Al Viro
2010-02-02  5:55       ` Eric W. Biederman
2010-02-02 17:01         ` Al Viro
2010-02-02 18:10           ` Olivier Galibert
2010-02-02 19:19           ` Eric W. Biederman
2010-02-03  3:04             ` Al Viro
2010-02-04  4:53               ` Al Viro
2010-02-02  4:22     ` Linus Torvalds [this message]
2010-02-02  5:00       ` Al Viro
2010-02-02  6:36         ` Nick Piggin
2010-02-04  6:02           ` Al Viro
2010-02-04  7:40             ` Nick Piggin
2010-02-02  6:53     ` Paul E. McKenney
2010-02-02  7:09       ` Al Viro
2010-02-02 13:32         ` Matthew Wilcox
2010-02-02 15:56           ` Linus Torvalds
2010-02-02 16:13             ` Matthew Wilcox
2010-02-02 16:43           ` Al Viro
2010-02-03 10:52         ` Paul E. McKenney
2010-02-03  2:49       ` Paul E. McKenney
2010-02-04 15:29         ` Linus Torvalds
2010-02-04 16:02           ` Paul E. McKenney
2010-02-04 17:13             ` Linus Torvalds
2010-02-04 17:36               ` Al Viro
2010-02-07 16:34                 ` Paul E. McKenney
2010-02-01 22:45 ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.1002012018400.3664@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.