]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: suggest "-d" option for repair of RO mount
authorEric Sandeen <sandeen@sandeen.net>
Mon, 18 Nov 2013 16:02:05 +0000 (16:02 +0000)
committerRich Johnston <rjohnston@sgi.com>
Tue, 3 Dec 2013 14:36:54 +0000 (08:36 -0600)
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.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
repair/init.c

index c3f380b3028a8cfa48acc05e5fb3089d8ed59e7e..d0940aaef73d547589c3b590ac24d64f1a1bd6a8 100644 (file)
@@ -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();