X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Futils%2Fmount_utils.c;h=b19aeef6e5e630bffb5209cb1a9f4bfa9c64f751;hb=12d6356a48de70922975e38451059211c753252e;hp=93a666a05087ff0464539925952ad7f54432b36d;hpb=2b294992edce5af7b79d4300ed3aa1ea6a8db850;p=fs%2Flustre-release.git diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 93a666a..b19aeef 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -490,7 +491,7 @@ struct module_backfs_ops *load_backfs_module(enum ldd_mount_type mount_type) /* This deals with duplicate ldd_mount_types resolving to same OSD layer * plugin (e.g. ext3/ldiskfs/ldiskfs2 all being ldiskfs) */ - strlcpy(fsname, mt_type(mount_type), sizeof(fsname)); + strncpy(fsname, mt_type(mount_type), sizeof(fsname)); name = fsname + sizeof("osd-") - 1; /* change osd- to osd_ */ @@ -572,7 +573,7 @@ int backfs_mount_type_okay(enum ldd_mount_type mount_type) } if (backfs_ops[mount_type] == NULL) { fatal(); - fprintf(stderr, "unhandled fs type %d '%s'\n", + fprintf(stderr, "unhandled/unloaded fs type %d '%s'\n", mount_type, mt_str(mount_type)); return 0; } @@ -705,14 +706,19 @@ int osd_enable_quota(struct mkfs_opts *mop) int osd_init(void) { - int i, ret = 0; + int i, rc, ret = EINVAL; for (i = 0; i < LDD_MT_LAST; ++i) { + rc = 0; backfs_ops[i] = load_backfs_module(i); if (backfs_ops[i] != NULL) - ret = backfs_ops[i]->init(); - if (ret) - break; + rc = backfs_ops[i]->init(); + if (rc != 0) { + backfs_ops[i]->fini(); + unload_backfs_module(backfs_ops[i]); + backfs_ops[i] = NULL; + } else + ret = 0; } return ret;