shithub: riscv

Download patch

ref: 8417787f994891759273865919b34b5a2e6e8735
parent: 508b796b2719e6c8275a2a1b737c9798d380d25f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Mar 14 19:19:17 EDT 2017

upas/fs: remove idx semaphore, cannot happen as symcmbox() always called with mailbox locked

--- a/sys/src/cmd/upas/fs/dat.h
+++ b/sys/src/cmd/upas/fs/dat.h
@@ -148,7 +148,6 @@
 typedef struct Mailbox Mailbox;
 struct Mailbox {
 	QLock;
-	long	idxsem;		/* abort on concurrent index access */
 	int	refs;
 	Mailbox	*next;
 	int	id;
--- a/sys/src/cmd/upas/fs/idx.c
+++ b/sys/src/cmd/upas/fs/idx.c
@@ -216,7 +216,6 @@
 	Biobuf b;
 	Dir *d;
 
-	assert(semacquire(&mb->idxsem, 0) != -1);
 	snprint(buf, sizeof buf, "%s.idx", mb->path);
 	iprint("wridxfile %s\n", buf);
 	if((fd = exopen(buf)) == -1){
@@ -224,7 +223,6 @@
 		if(strcmp(buf, "no creates") != 0)
 		if(strstr(buf, "file system read only") == 0)
 			eprint("wridxfile: %r\n");
-		semrelease(&mb->idxsem, 1);
 		return -1;
 	}
 	seek(fd, 0, 0);
@@ -237,7 +235,6 @@
 	mb->qid = d->qid;
 	free(d);
 	close(fd);
-	semrelease(&mb->idxsem, 1);
 	return r;
 }
 
@@ -526,10 +523,8 @@
 {
 	int r;
 
-	assert(semacquire(&mb->idxsem, 0) > 0);
 	r = rdidxfile0(mb, doplumb);
 	if(r == -1 && mb->idxinvalid)
 		mb->idxinvalid(mb);
-	semrelease(&mb->idxsem, 1);
 	return r;
 }
--- a/sys/src/cmd/upas/fs/mbox.c
+++ b/sys/src/cmd/upas/fs/mbox.c
@@ -176,7 +176,6 @@
 		*r = nil;
 	initheaders();
 	mb = emalloc(sizeof *mb);
-	mb->idxsem = 1;
 	mb->flags = flags;
 	strncpy(mb->path, path, sizeof mb->path - 1);
 	p = name;