Re: [PATCH v2 2/4] coda: don't d_drop() early.

From: Jan Harkes

Date: Fri Nov 20 2026 - 12:31:08 EST


On Mon, Nov 16, 2026 at 07:09:14PM -0500, NeilBrown wrote:
> From: NeilBrown <neil@xxxxxxxxxx>
>
> Proposed locking changes will mean that calling d_drop() could
> effectively unlock the name allowing a parallel lookup to proceed.
> For this reason it should only be called *after* the attempt to create a
> symlink (in this case) has completed (whether successfully or not).
>
> So move the d_drop() to after the venus_symlink() call.
>
> Doing this also means that if the upcall that handles venus_symlink()
> happens to look up the name being created, it will get -ENOENT rather
> then a possible deadlock.
>
> Signed-off-by: NeilBrown <neil@xxxxxxxxxx>

Acked-by: Jan Harkes <jaharkes@xxxxxxxxxx>

I was sort of already assuming that the userspace cache manager should
never ever traverse into the mounted /coda file system tree because
there is only a finite pool of worker threads. But it is good to know
that this change would fix at least one possible deadlock.

> ---
> fs/coda/dir.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/coda/dir.c b/fs/coda/dir.c
> index a85be5962e62..b47299527b65 100644
> --- a/fs/coda/dir.c
> +++ b/fs/coda/dir.c
> @@ -249,13 +249,13 @@ static int coda_symlink(const struct mnt_idmap *idmap,
> if (symlen > CODA_MAXPATHLEN)
> return -ENAMETOOLONG;
>
> + error = venus_symlink(dir_inode->i_sb, coda_i2f(dir_inode), name, len,
> + symname, symlen);
> /*
> - * This entry is now negative. Since we do not create
> + * This entry is still negative. Since we did not create
> * an inode for the entry we have to drop it.
> */
> d_drop(de);
> - error = venus_symlink(dir_inode->i_sb, coda_i2f(dir_inode), name, len,
> - symname, symlen);
>
> /* mtime is no good anymore */
> if (!error)
> --
> 2.50.0.107.gf914562f5916.dirty
>