Skip to contentSkip to conversation

xfsprogs: suggest "-d" option for repair of RO mount

RFC PATCH In review Eric Sandeen 5 participants 8 messages Nov 12, 2013 – Dec 3, 2013

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 xfsprogs: suggest "-d" option for repair of RO mount

How dangerous is dangerous?

We could offer the suggestion of a "-d" repair, if we're in single-user mode with the root fs mounted readonly.

This change suggests -d to repair any RO mounted fs.

---

repair/init.c +10 -1
index c3f380b..a7a7613 100644
@@ -97,8 +97,17 @@ xfs_init(libxfs_init_t *args)
 	else
 		args->isreadonly = LIBXFS_EXCLUSIVELY;
 
-	if (!libxfs_init(args))
+	if (!libxfs_init(args)) {
+		/* would -d be an option? */
+		if (!no_modify && !dangerously) {
+			args->isreadonly = (LIBXFS_ISINACTIVE |
+					    LIBXFS_DANGEROUSLY);
+			if (libxfs_init(args))
+				fprintf(stderr,
+_("Unmount or use -d to repair a read-only mounted filesystem\n"));
+		}
 		do_error(_("couldn't initialize XFS library\n"));
+	}
 
 	ts_create();
 	increase_rlimit();

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

Hm, even in single user with a RO root filesystem, changing filesystem on-disk filesystem structures without have them replied in memory looks dangerous to me, you will keep data consistency since the fs is RO, but how about memory? You might have a discrepancy between memory and disk metadata contents causing in-memory only problems?

Quoted 38 lines · Eric Sandeen

How dangerous is dangerous?

We could offer the suggestion of a "-d" repair, if we're in single-user mode with the root fs mounted readonly.

This change suggests -d to repair any RO mounted fs.

---

repair/init.c +10 -1
index c3f380b..a7a7613 100644
@@ -97,8 +97,17 @@ xfs_init(libxfs_init_t *args)
 	else
 		args->isreadonly = LIBXFS_EXCLUSIVELY;
 
-	if (!libxfs_init(args))
+	if (!libxfs_init(args)) {
+		/* would -d be an option? */
+		if (!no_modify && !dangerously) {
+			args->isreadonly = (LIBXFS_ISINACTIVE |
+					    LIBXFS_DANGEROUSLY);
+			if (libxfs_init(args))
+				fprintf(stderr,
+_("Unmount or use -d to repair a read-only mounted filesystem\n"));
+		}
 		do_error(_("couldn't initialize XFS library\n"));
+	}
 
 	ts_create();
 	increase_rlimit();

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Signature · 6 lines
Carlos

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
Quoted 6 lines · Carlos Maiolino

Hm, even in single user with a RO root filesystem, changing filesystem on-disk filesystem structures without have them replied in memory looks dangerous to me, you will keep data consistency since the fs is RO, but how about memory? You might have a discrepancy between memory and disk metadata contents causing in-memory only problems?

The possibility is already there; it's just a question of whether we suggest using it. And my other patch suggests an immediate reboot when it's done, for just those reasons.

A user needs some way to repair their root disk if they can't boot a rescue environment... and ext2/3/4 have been doing this since forever.

I know, none of the above are exactly arguments that its' safe... :)

-Eric

Quoted 32 lines · Eric Sandeen
Quoted 31 lines

How dangerous is dangerous?

We could offer the suggestion of a "-d" repair, if we're in single-user mode with the root fs mounted readonly.

This change suggests -d to repair any RO mounted fs.

---

repair/init.c +10 -1
index c3f380b..a7a7613 100644
@@ -97,8 +97,17 @@ xfs_init(libxfs_init_t *args)
 	else
 		args->isreadonly = LIBXFS_EXCLUSIVELY;
 
-	if (!libxfs_init(args))
+	if (!libxfs_init(args)) {
+		/* would -d be an option? */
+		if (!no_modify && !dangerously) {
+			args->isreadonly = (LIBXFS_ISINACTIVE |
+					    LIBXFS_DANGEROUSLY);
+			if (libxfs_init(args))
+				fprintf(stderr,
+_("Unmount or use -d to repair a read-only mounted filesystem\n"));
+		}
 		do_error(_("couldn't initialize XFS library\n"));
+	}
 
Quoted 8 lines
Quoted 7 lines
repair/init.c +0 -0
 	ts_create();
 	increase_rlimit();

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 11 lines · Eric Sandeen
Quoted 6 lines · Carlos Maiolino

Hm, even in single user with a RO root filesystem, changing filesystem on-disk filesystem structures without have them replied in memory looks dangerous to me, you will keep data consistency since the fs is RO, but how about memory? You might have a discrepancy between memory and disk metadata contents causing in-memory only problems?

The possibility is already there; it's just a question of whether we suggest using it. And my other patch suggests an immediate reboot when it's done, for just those reasons.

If you make the suggestion of using -d, then it should mention at that point in time it's dangerous.

Quoted 4 lines

A user needs some way to repair their root disk if they can't boot a rescue environment... and ext2/3/4 have been doing this since forever.

I know, none of the above are exactly arguments that its' safe... :)

Right, so let's make sure we don't give people any impression it is safe :)

Quoted 1 line
Quoted 1 line
Quoted 1 line

+_("Unmount or use -d to repair a read-only mounted filesystem\n"));

_("Unmount or use the dangerous (-d) option to repair a read-only mounted filesystem\n"));

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw

On 11/17/13, 1:56 PM, Dave Chinner wrote:

<snip>

Quoted 6 lines

Right, so let's make sure we don't give people any impression it is safe :)

Quoted 1 line
Quoted 1 line
Quoted 1 line

+_("Unmount or use -d to repair a read-only mounted filesystem\n"));

_("Unmount or use the dangerous (-d) option to repair a read-only mounted filesystem\n"));

Good idea, will send V2.

Quoted 4 lines

Cheers,

Dave.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#5 lore raw

PATCH v2 1/1 xfsprogs: suggest "-d" option for repair of RO mount

In reply to Eric Sandeen

We can offer the suggestion of a "-d" repair, if we're in single-user mode with i.e. the root fs mounted readonly.

This change suggests -d to repair any RO mounted fs.

e2fsck allows this, and users are used to being able to do it in single-user mode. A separate patch will recommend a reboot after repair completes.

---

V2: Now with more danger!

repair/init.c +10 -1
index c3f380b..a7a7613 100644
@@ -97,8 +97,17 @@ xfs_init(libxfs_init_t *args)
 	else
 		args->isreadonly = LIBXFS_EXCLUSIVELY;
 
-	if (!libxfs_init(args))
+	if (!libxfs_init(args)) {
+		/* would -d be an option? */
+		if (!no_modify && !dangerously) {
+			args->isreadonly = (LIBXFS_ISINACTIVE |
+					    LIBXFS_DANGEROUSLY);
+			if (libxfs_init(args))
+				fprintf(stderr,
+_("Unmount or use the dangerous (-d) option to repair a read-only mounted filesystem\n"));
+		}
 		do_error(_("couldn't initialize XFS library\n"));
+	}
 
 	ts_create();
 	increase_rlimit();

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v2 1/1
#6 lore raw
Quoted 5 lines · Eric Sandeen

We can offer the suggestion of a "-d" repair, if we're in single-user mode with i.e. the root fs mounted readonly.

This change suggests -d to repair any RO mounted fs.

Quoted 8 lines

e2fsck allows this, and users are used to being able to do it in single-user mode. A separate patch will recommend a reboot after repair completes.

---

V2: Now with more danger!

Exciting! Looks good.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs