noderemove - do not call puffs_setback here. noderemove is called

from rename (for existing target) and calling setback is not
appropriate in that context.  Do that call instead directly in the
callers (remove, rmdir).

From Nicola Girardi, part of PR/54829.
This commit is contained in:
uwe 2020-05-27 00:36:07 +00:00
parent b2db326b70
commit 8deaf9c1c0
1 changed files with 16 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $ */
/* $NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $");
__RCSID("$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $");
#endif /* !lint */
#include <assert.h>
@ -533,9 +533,6 @@ noderemove(struct puffs_usermount *pu, struct puffs_node *pn)
}
out:
if (rv == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
RETURN(rv);
}
@ -543,24 +540,36 @@ int
puffs9p_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs_node *pn = targ;
int rv;
if (pn->pn_va.va_type == VDIR)
return EISDIR;
return noderemove(pu, pn);
rv = noderemove(pu, pn);
if (rv == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
return rv;
}
int
puffs9p_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
const struct puffs_cn *pcn)
{
struct puffs_cc *pcc = puffs_cc_getcc(pu);
struct puffs_node *pn = targ;
int rv;
if (pn->pn_va.va_type != VDIR)
return ENOTDIR;
return noderemove(pu, pn);
rv = noderemove(pu, pn);
if (rv == 0)
puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
return rv;
}
/*