From: tappro Date: Tue, 15 Aug 2006 22:31:19 +0000 (+0000) Subject: add osd_shutdown() X-Git-Tag: v1_8_0_110~486^2~1166 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=fc79946c0f9e3995ae28f5ad06367a9b79391845;p=fs%2Flustre-release.git add osd_shutdown() --- diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index ef1eaa4..2fd7c52 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -1711,6 +1711,23 @@ static int osd_device_init(const struct lu_context *ctx, return 0; } +static int osd_shutdown(const struct lu_context *ctx, struct osd_device *o) +{ + struct osd_thread_info *info = lu_context_key_get(ctx, &osd_key); + ENTRY; + if (o->od_obj_area != NULL) { + dput(o->od_obj_area); + o->od_obj_area = NULL; + } + osd_oi_fini(info, &o->od_oi); + + if (o->od_mount) + server_put_mount(o->od_mount->lmi_name, o->od_mount->lmi_mnt); + o->od_mount = NULL; + + RETURN(0); +} + static int osd_mount(const struct lu_context *ctx, struct osd_device *o, struct lustre_cfg *cfg) { @@ -1748,7 +1765,7 @@ static int osd_mount(const struct lu_context *ctx, result = PTR_ERR(d); } if (result != 0) - osd_device_fini(ctx, osd2lu_dev(o)); + osd_shutdown(ctx, o); RETURN(result); } @@ -1759,16 +1776,6 @@ static struct lu_device *osd_device_fini(const struct lu_context *ctx, struct osd_thread_info *info = lu_context_key_get(ctx, &osd_key); ENTRY; - if (o->od_obj_area != NULL) { - dput(o->od_obj_area); - o->od_obj_area = NULL; - } - osd_oi_fini(info, &o->od_oi); - - if (o->od_mount) - server_put_mount(o->od_mount->lmi_name, o->od_mount->lmi_mnt); - - o->od_mount = NULL; RETURN(NULL); } @@ -1813,6 +1820,9 @@ static int osd_process_config(const struct lu_context *ctx, case LCFG_SETUP: err = osd_mount(ctx, o, cfg); break; + case LCFG_CLEANUP: + osd_shutdown(ctx, o); + break; default: err = -ENOTTY; }