[lkml]   [2021]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRE: [PATCH 03/14] d_path: regularize handling of root dentry in __dentry_path()

    > -----Original Message-----
    > From: Al Viro <> On Behalf Of Al Viro
    > Sent: Wednesday, May 19, 2021 8:49 AM
    > To: Linus Torvalds <>
    > Cc: Justin He <>; Petr Mladek <>; Steven
    > Rostedt <>; Sergey Senozhatsky
    > <>; Andy Shevchenko
    > <>; Rasmus Villemoes
    > <>; Jonathan Corbet <>; Heiko
    > Carstens <>; Vasily Gorbik <>; Christian
    > Borntraeger <>; Eric W . Biederman
    > <>; Darrick J. Wong <>; Peter
    > Zijlstra (Intel) <>; Ira Weiny <>;
    > Eric Biggers <>; Ahmed S. Darwish
    > <>; open list:DOCUMENTATION <linux-
    >>; Linux Kernel Mailing List <linux-
    >>; linux-s390 <>; linux-
    > fsdevel <>
    > Subject: [PATCH 03/14] d_path: regularize handling of root dentry in
    > __dentry_path()
    > All path-forming primitives boil down to sequence of prepend_name()
    > on dentries encountered along the way toward root. Each time we prepend
    > / + dentry name to the buffer. Normally that does exactly what we want,
    > but there's a corner case when we don't call prepend_name() at all (in case
    > of __dentry_path() that happens if we are given root dentry). We obviously
    > want to end up with "/", rather than "", so this corner case needs to be
    > handled.
    > __dentry_path() used to manually put '/' in the end of buffer before
    > doing anything else, to be overwritten by the first call of prepend_name()
    > if one happens and to be left in place if we don't call prepend_name() at
    > all. That required manually checking that we had space in the buffer
    > (prepend_name() and prepend() take care of such checks themselves) and lead
    > to clumsy keeping track of return value.
    > A better approach is to check if the main loop has added anything
    > into the buffer and prepend "/" if it hasn't. A side benefit of using
    > prepend()
    > is that it does the right thing if we'd already run out of buffer, making
    > the overflow-handling logics simpler.
    > Signed-off-by: Al Viro <>
    Reviewed-by: Jia He <>

    Justin (Jia He)

    IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

     \ /
      Last update: 2021-07-07 06:51    [W:4.413 / U:0.816 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site