[Ocfs2-tools-devel] [PATCH 03/14] fsck.ocfs2: abort if fs is mounted

Junxiao Bi junxiao.bi at oracle.com
Thu Mar 31 20:10:04 PDT 2016


Do fsck on mounted volume may cause severe corruption, this is not supported
by fsck.ext4, so disable it for fsck.ocfs2. In the meanwhile, fsck -fn to
mounted volume is still supported as fs is read-only in this way.

Acked-by: Srinivas Eeda <srinivas.eeda at oracle.com>
Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
 fsck.ocfs2/fsck.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fsck.ocfs2/fsck.c b/fsck.ocfs2/fsck.c
index 4b7d4b3d67d1..b8ad0e7d54e7 100644
--- a/fsck.ocfs2/fsck.c
+++ b/fsck.ocfs2/fsck.c
@@ -845,10 +845,13 @@ int main(int argc, char **argv)
 			fprintf(stdout, "\nWARNING!!! Running fsck.ocfs2 (read-"
 				"only) on a mounted filesystem may detect "
 				"invalid errors.\n\n");
-		else
-			fprintf(stdout, "\nWARNING!!! Running fsck.ocfs2 on a "
+		else {
+			fprintf(stdout, "\nRunning fsck.ocfs2 on a "
 				"mounted filesystem may cause SEVERE "
-				"filesystem damage.\n\n");
+				"filesystem damage, abort.\n\n");
+			fsck_mask |= FSCK_CANCELED;
+			goto out;
+		}
 		proceed = 0;
 	}
 
-- 
1.7.9.5




More information about the Ocfs2-tools-devel mailing list