[lkml]   [2010]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH][RFC] %pd - for printing dentry name

    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

    > 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

    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..


     \ /
      Last update: 2010-02-02 05:25    [W:0.023 / U:4.208 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site