shithub: lwext4

Download patch

ref: ec7dc1a76069a78dec96644b5ff21bc3926ee277
parent: ae719f95ab66cc16f5302ee8f1435b40dafe7d35
author: gkostka <kostka.grzegorz@gmail.com>
date: Thu Dec 3 03:39:18 EST 2015

Add lock/unlock mountpoint to ext4_recover

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -466,16 +466,19 @@
 		return ENOENT;
 
 	int r = ENOTSUP;
+	EXT4_MP_LOCK(mp);
 	if (ext4_sb_feature_com(&mp->fs.sb, EXT4_FCOM_HAS_JOURNAL)) {
 		struct jbd_fs *jbd_fs = calloc(1, sizeof(struct jbd_fs));
-		if (!jbd_fs)
-			return ENOMEM;
+		if (!jbd_fs) {
+			 r = ENOMEM;
+			 goto Finish;
+		}
 
 
 		r = jbd_get_fs(&mp->fs, jbd_fs);
 		if (r != EOK) {
 			free(jbd_fs);
-			return r;
+			goto Finish;
 		}
 
 		r = jbd_recover(jbd_fs);
@@ -483,6 +486,9 @@
 		free(jbd_fs);
 	}
 
+
+Finish:
+	EXT4_MP_UNLOCK(mp);
 	return r;
 }