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

Junxiao Bi junxiao.bi at oracle.com
Wed May 27 20:11:17 PDT 2015


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.

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 4b7d4b3..b8ad0e7 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