From 98564a94edd347f2fff897bdf4925ef82134a52a Mon Sep 17 00:00:00 2001 From: tappro Date: Wed, 18 Oct 2006 21:47:11 +0000 Subject: [PATCH] - handle errors during fid allocation instead of LBUG() - remove #if 1 - #endif around lmv_all_chars_policy() - fix needless line breaking --- lustre/llite/dcache.c | 16 +++++++--------- lustre/llite/namei.c | 14 ++++++++------ lustre/lmv/lmv_obd.c | 11 +++-------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 9ba0b80..46e4dbb 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -406,15 +406,14 @@ int ll_revalidate_it(struct dentry *de, int lookup_flags, de->d_name.name, de->d_name.len, 0); if (op_data == NULL) RETURN(-ENOMEM); - rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, - &hint); + rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, &hint); if (rc) { - CERROR("can't allocate new fid, rc %d\n", rc); - LBUG(); + ll_finish_md_op_data(op_data); + RETURN(rc); } } else { op_data = ll_prep_md_op_data(NULL, parent, de->d_inode, - de->d_name.name, de->d_name.len, 0); + de->d_name.name, de->d_name.len, 0); if (op_data == NULL) RETURN(-ENOMEM); } @@ -583,11 +582,10 @@ do_lookup: .ph_cname = &de->d_name, .ph_opc = LUSTRE_OPC_CREATE }; - rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, - &hint); + rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, &hint); if (rc) { - CERROR("can't allocate new fid, rc %d\n", rc); - LBUG(); + ll_finish_md_op_data(op_data); + RETURN(rc); } } diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index a6757d7..2c5fee4 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -489,8 +489,10 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, .ph_opc = LUSTRE_OPC_CREATE }; rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, &hint); - if (rc) - LBUG(); + if (rc) { + ll_finish_md_op_data(op_data); + RETURN(rc); + } } it->it_create_mode &= ~current->fs->umask; @@ -893,8 +895,8 @@ static int ll_symlink_generic(struct inode *dir, struct dentry *dchild, /* allocate new fid */ err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data->fid2, &hint); if (err) { - CERROR("can't allocate new fid, rc %d\n", err); - LBUG(); + ll_finish_md_op_data(op_data); + RETURN(err); } err = md_create(sbi->ll_md_exp, op_data, @@ -970,8 +972,8 @@ static int ll_mkdir_generic(struct inode *dir, struct qstr *name, /* Allocate new fid. */ err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data->fid2, &hint); if (err) { - CERROR("Can't allocate new fid, rc %d\n", err); - LBUG(); + ll_finish_md_op_data(op_data); + RETURN(err); } err = md_create(sbi->ll_md_exp, op_data, NULL, 0, mode, diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 489d009..849ef09 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -707,7 +707,6 @@ static int lmv_fids_balanced(struct obd_device *obd) RETURN(1); } -#if 1 static int lmv_all_chars_policy(int count, struct qstr *name) { unsigned int c = 0; @@ -718,7 +717,6 @@ static int lmv_all_chars_policy(int count, struct qstr *name) c = c % count; return c; } -#endif static int lmv_placement_policy(struct obd_device *obd, struct lu_placement_hint *hint, @@ -846,8 +844,7 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, rc = fld_client_create(&lmv->lmv_fld, fid_seq(fid), mds, NULL); if (rc) { - CERROR("Can't create fld entry, " - "rc %d\n", rc); + CERROR("Can't create fld entry, rc %d\n", rc); } } @@ -869,15 +866,13 @@ static int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid, rc = lmv_placement_policy(obd, hint, &mds); if (rc) { - CERROR("Can't get target for allocating fid, " - "rc %d\n", rc); + CERROR("Can't get target for allocating fid, rc %d\n", rc); RETURN(rc); } rc = __lmv_fid_alloc(lmv, fid, mds); if (rc) { - CERROR("Can't alloc new fid, rc %d\n", - rc); + CERROR("Can't alloc new fid, rc %d\n", rc); RETURN(rc); } -- 1.8.3.1