lkml.org 
[lkml]   [2018]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Race-free unlinking of directory entries
    On Monday 09 April 2018 03:24:14 Christoph Hellwig wrote:
    > On Mon, Apr 09, 2018 at 12:10:09PM +0200, Pali Rohár wrote:
    > > Another example:
    > >
    > > fd = open("/a")
    > > link("/a", "/b")
    > > unlink("/a")
    > >
    > > Calling funlink for fd should unlink "/b" or it should fail?
    >
    > It should fail, as '/a' doesn't refer to name that is visible in the
    > namespace.
    >
    > > And another example:
    > >
    > > fd = open("/a")
    > > rename("/a", "/b")
    > >
    > > What should funlink do for fd now?
    >
    > remove the directory entry refering to '/b' as that is what fd refers
    > to.

    Why it should differ in these two cases? Calling /bin/ln /a /b followed by
    /bin/rm /a results in the same state as calling /bin/mv /a /b. This is
    something which works in POSIX systems.

    I think it is strange that new possible funlink call would work only if
    external applications uses /bin/mv and would fail if /bin/ln and /bin/rm
    are used.

    This is reason why I suggested two parameters funlink, it takes fd for
    unlinking and pathname which must contain same inode as fd. So when you
    call it with fd+"/b" it unlink "/b" without failing.

    --
    Pali Rohár
    pali.rohar@gmail.com

    \
     
     \ /
      Last update: 2018-04-09 12:36    [W:2.968 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site