git: 9front

Download patch

ref: 2564d5dc68a22bdfaa2a54a436151ad1527b455d
parent: 00da90ce6ee61be1567f8817eee381498dc7b3f8
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Feb 22 17:44:01 EST 2016

ndb/dns: initialize unknown fids to point to the root qid

the dns file service can be restarted, which causes it to forget
all fid state. given the simple file system structure of the dns
service (just a single dns file), we can assume that rpcs
on a unknown fid refers to the root, so the mountpoint will stay
valid and /net/dns can be reopend avoiding the need for a remount
of the dns service after restart.

--- a/sys/src/cmd/ndb/dns.c
+++ b/sys/src/cmd/ndb/dns.c
@@ -320,7 +320,10 @@
 		}
 	mf = emalloc(sizeof(*mf));
 	mf->fid = fid;
-	mf->user = estrdup("dummy");
+	mf->qid.vers = vers;
+	mf->qid.type = QTDIR;
+	mf->qid.path = 0LL;
+	mf->user = estrdup("none");
 	mf->next = mfalloc.inuse;
 	mfalloc.inuse = mf;
 	unlock(&mfalloc);
@@ -355,7 +358,7 @@
 	if(nmf == nil)
 		return nil;
 	nmf->fid = fid;
-	free(nmf->user);			/* estrdup("dummy") */
+	free(nmf->user);			/* estrdup("none") */
 	nmf->user = estrdup(mf->user);
 	nmf->qid.type = mf->qid.type;
 	nmf->qid.path = mf->qid.path;
--