X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fllog_lvfs.c;h=cb83ed2e8e7a17127ca5f811600497a3af5cddaa;hb=1932a135cf8cedcea2d0f2d5be21edd7fe306251;hp=4f0e45be2ce6195036198ad1563b52e7db8833d1;hpb=0e660eab787c3b2857e4295f1ec554e016393885;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index 4f0e45b..cb83ed2 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -367,7 +367,8 @@ static int llog_lvfs_write_rec(struct llog_handle *loghandle, reccookie->lgc_lgl = loghandle->lgh_id; reccookie->lgc_index = index; if ((rec->lrh_type == MDS_UNLINK_REC) || - (rec->lrh_type == MDS_SETATTR_REC)) + (rec->lrh_type == MDS_SETATTR_REC) || + (rec->lrh_type == MDS_SETATTR64_REC)) reccookie->lgc_subsys = LLOG_MDS_OST_ORIG_CTXT; else if (rec->lrh_type == OST_SZ_REC) reccookie->lgc_subsys = LLOG_SIZE_ORIG_CTXT; @@ -592,7 +593,7 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, struct obd_device *obd; struct l_dentry *dchild = NULL; struct obdo *oa = NULL; - int rc = 0, cleanup_phase = 1; + int rc = 0; int open_flags = O_RDWR | O_CREAT | O_LARGEFILE; ENTRY; @@ -613,24 +614,25 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, rc = PTR_ERR(dchild); CERROR("error looking up logfile "LPX64":0x%x: rc %d\n", logid->lgl_oid, logid->lgl_ogen, rc); - GOTO(cleanup, rc); + GOTO(out, rc); } - cleanup_phase = 2; if (dchild->d_inode == NULL) { + l_dput(dchild); rc = -ENOENT; CERROR("nonexistent log file "LPX64":"LPX64": rc %d\n", logid->lgl_oid, logid->lgl_ogr, rc); - GOTO(cleanup, rc); + GOTO(out, rc); } + /* l_dentry_open will call dput(dchild) if there is an error */ handle->lgh_file = l_dentry_open(&obd->obd_lvfs_ctxt, dchild, O_RDWR | O_LARGEFILE); if (IS_ERR(handle->lgh_file)) { rc = PTR_ERR(handle->lgh_file); CERROR("error opening logfile "LPX64"0x%x: rc %d\n", logid->lgl_oid, logid->lgl_ogen, rc); - GOTO(cleanup, rc); + GOTO(out, rc); } /* assign the value of lgh_id for handle directly */ @@ -640,7 +642,7 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, handle->lgh_file = llog_filp_open(MOUNT_CONFIGS_DIR, name, open_flags, 0644); if (IS_ERR(handle->lgh_file)) - GOTO(cleanup, rc = PTR_ERR(handle->lgh_file)); + GOTO(out, rc = PTR_ERR(handle->lgh_file)); handle->lgh_id.lgl_ogr = 1; handle->lgh_id.lgl_oid = @@ -650,25 +652,25 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, } else { OBDO_ALLOC(oa); if (oa == NULL) - GOTO(cleanup, rc = -ENOMEM); + GOTO(out, rc = -ENOMEM); oa->o_gr = FILTER_GROUP_LLOG; oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP; rc = obd_create(ctxt->loc_exp, oa, NULL, NULL); if (rc) - GOTO(cleanup, rc); + GOTO(out, rc); dchild = obd_lvfs_fid2dentry(ctxt->loc_exp, oa->o_id, oa->o_generation, oa->o_gr); if (IS_ERR(dchild)) - GOTO(cleanup, rc = PTR_ERR(dchild)); - cleanup_phase = 2; + GOTO(out, rc = PTR_ERR(dchild)); + handle->lgh_file = l_dentry_open(&obd->obd_lvfs_ctxt, dchild, open_flags); if (IS_ERR(handle->lgh_file)) - GOTO(cleanup, rc = PTR_ERR(handle->lgh_file)); + GOTO(out, rc = PTR_ERR(handle->lgh_file)); handle->lgh_id.lgl_ogr = oa->o_gr; handle->lgh_id.lgl_oid = oa->o_id; @@ -676,18 +678,13 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, } handle->lgh_ctxt = ctxt; - finish: +out: + if (rc) + llog_free_handle(handle); + if (oa) OBDO_FREE(oa); RETURN(rc); -cleanup: - switch (cleanup_phase) { - case 2: - l_dput(dchild); - case 1: - llog_free_handle(handle); - } - goto finish; } static int llog_lvfs_close(struct llog_handle *handle) @@ -754,7 +751,7 @@ static int llog_lvfs_destroy(struct llog_handle *handle) } /* reads the catalog list */ -int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, +int llog_get_cat_list(struct obd_device *disk_obd, char *name, int idx, int count, struct llog_catid *idarray) { struct lvfs_run_ctxt saved; @@ -767,7 +764,7 @@ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, if (!count) RETURN(0); - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700); if (!file || IS_ERR(file)) { rc = PTR_ERR(file); @@ -798,7 +795,7 @@ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, EXIT; out: - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); if (file && !IS_ERR(file)) rc1 = filp_close(file, 0); if (rc == 0) @@ -808,7 +805,7 @@ int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, EXPORT_SYMBOL(llog_get_cat_list); /* writes the cat list */ -int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, +int llog_put_cat_list(struct obd_device *disk_obd, char *name, int idx, int count, struct llog_catid *idarray) { struct lvfs_run_ctxt saved; @@ -820,7 +817,7 @@ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, if (!count) GOTO(out1, rc = 0); - push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700); if (!file || IS_ERR(file)) { rc = PTR_ERR(file); @@ -843,7 +840,7 @@ int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, } out: - pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); + pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL); if (file && !IS_ERR(file)) rc1 = filp_close(file, 0); @@ -918,14 +915,14 @@ static int llog_lvfs_destroy(struct llog_handle *handle) return 0; } -int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd, +int llog_get_cat_list(struct obd_device *disk_obd, char *name, int idx, int count, struct llog_catid *idarray) { LBUG(); return 0; } -int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd, +int llog_put_cat_list(struct obd_device *disk_obd, char *name, int idx, int count, struct llog_catid *idarray) { LBUG();