Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 1996 08:24:45 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, terry@lambert.org
Cc:        freebsd-current@FreeBSD.ORG, jhay@mikom.csir.co.za
Subject:   Re: fixes for rename panic (round 1)
Message-ID:  <199603062124.IAA07079@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Have you tested these changes with MDOSFS (especially) and EXT2FS
>(less especially)?

No.  These fixes can't possible affect msdsofs since they are in
ufs_rename() and msdosfs uses msdosfs_rename().  ext2fs uses
ufs_rename() almost directly and should benefit from the changes,
but I haven't tested it.  msdosfs_rename() must make its own
arrangement to handle the initial race (fvp == tvp), reference
counting for relookup(), and races involving relookup().  It
currently gets everything wrong.  E.g., msdosfs doesn't have links,
so (fvp == tvp) "can't happen", so it isn't handled.  However, it
happens because of the race in rename().

>I suspect a potential deadlock on identical
>path prefixes one path component off, and on "." and ".." references
>for some particular cases.

I think the potential for deadlock is avoided by not locking fdvp/fvp,
in rename(), and similar things in xxx_rename() (unlocking everything
before calling relookup() and xxxcheckpath()).  This costs a lot of
complexity to handle the resulting races.

>The existance of the race on the rename is intentional based on the
>need to hold the directory exclusively when inserting an entry.

No, it's because of the potential for deadlock if the `from' and the
`to' directory entries and parent directories are all locked at once.
fdvp/fvp are intentionally left unlocked so that deadlock can't occur.
This creates problems later.  The most complicated case is moving a
directory to a new parent directory.  As well as there being more links
to change in this case, everything is unlocked so it it is possible for
both the source and the destination directory entries and parent
directory entries to vanish.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603062124.IAA07079>