shithub: gefs

Download patch

ref: 05420abe523462b2fef257fb43cee02c9bb218b7
parent: d04b0098fc3982cb64e170895992389488ef8d9a
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Nov 9 00:08:31 EST 2023

dump: don't take lock when dumping snaps

if we have a crashed proc while updating snaps, it's
likely to hold the mount lock, so acquiring the mount
lock means we deadlock in 'show snap', depriving us of
a useful debug tool, in exchange for some not so useful
informatin that we can grab from acid painlessly.

--- a/dump.c
+++ b/dump.c
@@ -376,7 +376,6 @@
 showsnap(int fd, char **ap, int na)
 {
 	char *e, pfx[Snapsz];
-	Mount *mnt;
 	vlong id;
 	Scan s;
 	uint flg;
@@ -385,13 +384,6 @@
 
 	/* dump the labels */
 	if(na == 0){
-		lock(&fs->mountlk);
-		fprint(fd, "open:");
-		for(mnt = fs->mounts; mnt != nil; mnt = mnt->next)
-			fprint(fd, " %s\n", mnt->name);
-		fprint(fd, "\n");
-		unlock(&fs->mountlk);
-
 		pfx[0] = Klabel;
 		sz = 1;
 		btnewscan(&s, pfx, sz);