Adds error messages to mount.ocfs2 when mount point is invalid in three 
conditions:
1) mount point does not exist.
2) mount point is a symbolic link.
3) mount point is not a directory.
Adding these error messages can help ocfs2console provides more helpful 
feedback information to end 
use. Similar information can be found when mounting ext[234] file systems.

Patch is generated against upstream ocfs2-tools.

Signed-off-by: Coly Li <[EMAIL PROTECTED]>
Cc: Joel Becker <[EMAIL PROTECTED]>
Cc: Tao Ma <[EMAIL PROTECTED]>
Cc: Tiger Yang <[EMAIL PROTECTED]>
---
diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
index a97b4cb..eb8e336 100644
--- a/mount.ocfs2/mount.ocfs2.c
+++ b/mount.ocfs2/mount.ocfs2.c
@@ -382,9 +382,21 @@ int main(int argc, char **argv)
                        o2cb_complete_group_join(&cluster, &desc, errno);
                }
                block_signals (SIG_UNBLOCK);
-               com_err(progname, ret, "while mounting %s on %s. "
-                       "Check 'dmesg' for more information on this error.",
-                       mo.dev, mo.dir);
+
+               /* complain mount failure */
+               if (lstat(mo.dir, &statbuf))
+                       com_err(progname, 0, "mount point %s does not "
+                               "exist", mo.dir);
+               else if (stat(mo.dir, &statbuf))
+                       com_err(progname, 0, "mount point %s is a "
+                               "symbolic link to nowhere", mo.dir);
+               else if (stat(mo.dir, &statbuf) || !S_ISDIR(statbuf.st_mode))
+                       com_err(progname, 0, "mount point %s is not "
+                               "a directory", mo.dir);
+               else
+                       com_err(progname, ret, "while mounting %s on %s. "
+                               "Check 'dmesg' for more information on this "
+                               "error.", mo.dev, mo.dir);
                goto bail;
        }
        if (hb_started) {

-- 
Coly Li
SuSE PRC Labs

_______________________________________________
Ocfs2-devel mailing list
[email protected]
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

Reply via email to