Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/puffs/mount_9p noderemove - do not call puffs_setba...



details:   https://anonhg.NetBSD.org/src/rev/11a0868313f1
branches:  trunk
changeset: 972464:11a0868313f1
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed May 27 00:36:07 2020 +0000

description:
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.

diffstat:

 usr.sbin/puffs/mount_9p/node.c |  23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diffs (67 lines):

diff -r 59c2e768dbe8 -r 11a0868313f1 usr.sbin/puffs/mount_9p/node.c
--- a/usr.sbin/puffs/mount_9p/node.c    Wed May 27 00:05:22 2020 +0000
+++ b/usr.sbin/puffs/mount_9p/node.c    Wed May 27 00:36:07 2020 +0000
@@ -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 @@
        }
 
  out:
-       if (rv == 0)
-               puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
-
        RETURN(rv);
 }
 
@@ -543,24 +540,36 @@
 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;
 }
 
 /*



Home | Main Index | Thread Index | Old Index