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;
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;
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 */
handle->lgh_id = *logid;
} else if (name) {
- /* COMPAT_146 */
- if (strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME) == 0) {
- handle->lgh_file = llog_filp_open(MDT_LOGS_DIR, name,
- open_flags, 0644);
- } else {
- /* end COMPAT_146 */
- handle->lgh_file = llog_filp_open(MOUNT_CONFIGS_DIR,
- name, open_flags,
- 0644);
- }
+ 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 =
} 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;
}
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)
int rc;
ENTRY;
- /* COMPAT_146 */
- if (strcmp(obd->obd_type->typ_name, LUSTRE_MDS_NAME) == 0)
- dir = MDT_LOGS_DIR;
- else
- /* end COMPAT_146 */
- dir = MOUNT_CONFIGS_DIR;
+ dir = MOUNT_CONFIGS_DIR;
fdentry = handle->lgh_file->f_dentry;
if (strcmp(fdentry->d_parent->d_name.name, dir) == 0) {
if (rc)
GOTO(out, rc);
- rc = obd_destroy(handle->lgh_ctxt->loc_exp, oa, NULL, NULL, NULL);
+ rc = obd_destroy(handle->lgh_ctxt->loc_exp, oa, NULL, NULL, NULL, NULL);
out:
OBDO_FREE(oa);
RETURN(rc);
}
/* 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;
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);
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)
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;
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);
}
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);
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();