shithub: gefs

Download patch

ref: d164aa7714b3a0f679bcacffb9a716a57cb7c0cb
parent: f6343dccd7c7a52c1f7688790fcf5822b5ece9ec
author: Ori Bernstein <[email protected]>
date: Mon May 8 07:05:35 EDT 2023

gefs: correctly handle OEXCL locking

--- a/dat.h
+++ b/dat.h
@@ -130,7 +130,6 @@
 extern char Etype[];
 extern char Edscan[];
 extern char Esrch[];
-extern char Efsrch[];
 extern char Eexist[];
 extern char Emode[];
 extern char Efull[];
--- a/error.c
+++ b/error.c
@@ -11,8 +11,7 @@
 char Efid[]	= "fid in use";
 char Etype[]	= "invalid fid type";
 char Edscan[]	= "invalid dir scan offset";
-char Esrch[]	= "key not found";
-char Efsrch[]	= "directory entry not found";
+char Esrch[]	= "directory entry not found";
 char Eexist[]	= "create/wstat -- file exists";
 char Emode[]	= "open/create -- unknown mode";
 char Efull[]	= "file system full";
--- a/fs.c
+++ b/fs.c
@@ -1080,7 +1080,7 @@
 		name = m->wname[i];
 		if(d.qid.path == Qdump){
 			if((mnt = getmount(m->wname[i])) == nil){
-				rerror(m, Efsrch);
+				rerror(m, Esrch);
 				putfid(o);
 				return;
 			}
@@ -1691,7 +1691,8 @@
 		putfid(f);
 		return;
 	}
-	if(f->dent->mode & DMEXCL){
+	if(f->dent->qid.type & QTEXCL)
+	if(f->dent->ref != 1){
 		rerror(m, Elocked);
 		goto Disallow;
 	}