shithub: gefs

Download patch

ref: 7d78f855dec94551acb6e02fad0fe42c6425aeec
parent: 3619a9bf8dc0ed957cbd85b00f4bd050dfb97013
author: Michael Forney <[email protected]>
date: Thu Feb 3 05:54:16 EST 2022

fs: increase fid ref before unlocking fidtab

--- a/fs.c
+++ b/fs.c
@@ -425,11 +425,11 @@
 	h = ihash(fid) % Nfidtab;
 	lock(&fs->fidtablk);
 	for(f = fs->fidtab[h]; f != nil; f = f->next)
-		if(f->fid == fid)
+		if(f->fid == fid){
+			ainc(&f->ref);
 			break;
+		}
 	unlock(&fs->fidtablk);
-	if(f != nil)
-		ainc(&f->ref);
 	return f;
 }