Module Name:    src
Committed By:   uwe
Date:           Wed May 27 00:36:08 UTC 2020

Modified Files:
        src/usr.sbin/puffs/mount_9p: node.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_9p/node.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/puffs/mount_9p/node.c
diff -u src/usr.sbin/puffs/mount_9p/node.c:1.26 src/usr.sbin/puffs/mount_9p/node.c:1.27
--- src/usr.sbin/puffs/mount_9p/node.c:1.26	Wed May 27 00:05:22 2020
+++ src/usr.sbin/puffs/mount_9p/node.c	Wed May 27 00:36:07 2020
@@ -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, s
 	}
 
  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;
 }
 
 /*

Reply via email to