]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mount.ceph: Modprobe ceph before trying the mount.
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Tue, 29 Mar 2011 00:32:24 +0000 (17:32 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Tue, 29 Mar 2011 19:55:16 +0000 (12:55 -0700)
This will be needed for the next few commits, where we try to load the
keys into the kernel; without ceph.ko loaded, the key type will not be
recognized.

Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
src/mount/mount.ceph.c

index 70583c6ae48a526775dbe0bdc3b5aea33a0051e5..5ec62a2693ef7359984516e1cc081542aecaf119 100755 (executable)
@@ -356,6 +356,30 @@ static int parse_arguments(int argc, char *const *const argv,
        return 0;
 }
 
+/* modprobe failing doesn't necessarily prevent from working, so this
+   returns void */
+static void modprobe(void) {
+       int status;
+       status = system("modprobe ceph");
+       if (status < 0) {
+               fprintf(stderr, "mount.ceph: cannot run modprobe: %s\n", strerror(errno));
+       } else if (WIFEXITED(status)) {
+               status = WEXITSTATUS(status);
+               if (status != 0) {
+                       fprintf(stderr,
+                               "mount.ceph: modprobe failed, exit status %d\n",
+                               status);
+               }
+       } else if (WIFSIGNALED(status)) {
+               fprintf(stderr,
+                       "mount.ceph: modprobe failed with signal %d\n",
+                       WTERMSIG(status));
+       } else {
+               fprintf(stderr, "mount.ceph: weird status from modprobe: %d\n",
+                       status);
+       }
+}
+
 static void usage(const char *prog_name)
 {
        printf("usage: %s [src] [mount-point] [-v] [-o ceph-options]\n",
@@ -387,6 +411,8 @@ int main(int argc, char *argv[])
                exit(1);
        }
 
+       modprobe();
+
        popts = parse_options(opts, &flags);
        if (!popts) {
                printf("failed to parse ceph_options\n");