From 26f4be3976ffda2a68bb62b1d847410ca028e48f Mon Sep 17 00:00:00 2001 From: adilger Date: Tue, 24 May 2005 22:24:48 +0000 Subject: [PATCH] Branch b1_4 Comments and other purely cosmetic fixes. --- lustre/include/linux/lustre_mds.h | 4 +- lustre/include/linux/obd_class.h | 4 +- lustre/mdc/mdc_locks.c | 4 +- lustre/mds/mds_unlink_open.c | 2 + lustre/obdclass/genops.c | 77 +++++++++++++++++++-------------------- lustre/obdclass/obd_config.c | 34 ++++++++--------- lustre/obdfilter/filter_io_26.c | 28 +++++++------- lustre/ptlrpc/recover.c | 17 +++------ 8 files changed, 83 insertions(+), 87 deletions(-) diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index b6d30be..301a90c 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -131,13 +131,13 @@ struct mds_client_data { struct mds_file_data { struct portals_handle mfd_handle; /* must be first */ atomic_t mfd_refcount; - struct list_head mfd_list; + struct list_head mfd_list; /* protected by med_open_lock */ __u64 mfd_xid; int mfd_mode; struct dentry *mfd_dentry; }; -/* mds/mds_reint.c */ +/* mds/mds_reint.c */ int mds_reint_rec(struct mds_update_record *r, int offset, struct ptlrpc_request *req, struct lustre_handle *); diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index eda2851..00d3e86 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -301,8 +301,8 @@ static inline int obd_cleanup(struct obd_device *obd) { int rc; ENTRY; - - OBD_CHECK_DEV(obd); + + OBD_CHECK_DEV(obd); OBD_CHECK_OP(obd, cleanup, 0); OBD_COUNTER_INCREMENT(obd, cleanup); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 6f16f23..ab02ee8 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -164,7 +164,7 @@ int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid, res_id.name[0] = fid->id; res_id.name[1] = fid->generation; - ldlm_change_cbdata(class_exp2obd(exp)->obd_namespace, &res_id, it, + ldlm_change_cbdata(class_exp2obd(exp)->obd_namespace, &res_id, it, data); EXIT; @@ -631,7 +631,7 @@ int mdc_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt, sizeof(lockh)); } } - CDEBUG(D_DENTRY, "D_IT dentry %.*s intent: %s status %d disp %x rc %d\n", + CDEBUG(D_DENTRY,"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n", len, name, ldlm_it2str(it->it_op), it->d.lustre.it_status, it->d.lustre.it_disposition, rc); diff --git a/lustre/mds/mds_unlink_open.c b/lustre/mds/mds_unlink_open.c index 737299c..6cd750d 100644 --- a/lustre/mds/mds_unlink_open.c +++ b/lustre/mds/mds_unlink_open.c @@ -174,6 +174,8 @@ int mds_cleanup_orphans(struct obd_device *obd) ENTRY; push_ctxt(&saved, &obd->obd_ctxt, NULL); + /* dentry and mnt ref dropped in dentry_open() on error, or + * in filp_close() if dentry_open() succeeds */ dentry = dget(mds->mds_pending_dir); if (IS_ERR(dentry)) GOTO(err_pop, rc = PTR_ERR(dentry)); diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 4fa4a89..3ecbb54 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -240,7 +240,7 @@ int class_name2dev(char *name) if (obd->obd_name && strcmp(name, obd->obd_name) == 0) { /* Make sure we finished attaching before we give out any references */ - if (obd->obd_attached) { + if (obd->obd_attached) { spin_unlock(&obd_dev_lock); return i; } @@ -369,7 +369,7 @@ static void obd_cleanup_qunit_cache(void) for (i = 0; i < NR_DQHASH; i++) LASSERT(list_empty(qunit_hash + i)); spin_unlock(&qunit_hash_lock); - + if (qunit_cachep) { LASSERTF(kmem_cache_destroy(qunit_cachep) == 0, "Cannot destroy ll_qunit_cache\n"); @@ -399,9 +399,9 @@ static int obd_init_qunit_cache(void) { int i; ENTRY; - + LASSERT(qunit_cachep == NULL); - qunit_cachep = kmem_cache_create("ll_qunit_cache", + qunit_cachep = kmem_cache_create("ll_qunit_cache", sizeof(struct lustre_qunit), 0, 0, NULL, NULL); if (!qunit_cachep) @@ -556,7 +556,7 @@ struct obd_export *class_new_export(struct obd_device *obd) LASSERT(!obd->obd_stopping); /* shouldn't happen, but might race */ atomic_inc(&obd->obd_refcount); list_add(&export->exp_obd_chain, &export->exp_obd->obd_exports); - list_add_tail(&export->exp_obd_chain_timed, + list_add_tail(&export->exp_obd_chain_timed, &export->exp_obd->obd_exports_timed); export->exp_obd->obd_num_exports++; spin_unlock(&obd->obd_dev_lock); @@ -740,7 +740,7 @@ static void class_disconnect_export_list(struct list_head *list, int flags) struct obd_export *fake_exp, *exp; ENTRY; - /* It's possible that an export may disconnect itself, but + /* It's possible that an export may disconnect itself, but * nothing else will be added to this list. */ while(!list_empty(list)) { exp = list_entry(list->next, struct obd_export, exp_obd_chain); @@ -810,7 +810,7 @@ void class_disconnect_stale_exports(struct obd_device *obd) struct obd_export *exp; int cnt = 0; ENTRY; - + INIT_LIST_HEAD(&work_list); spin_lock(&obd->obd_dev_lock); list_for_each_safe(pos, n, &obd->obd_exports) { @@ -823,7 +823,7 @@ void class_disconnect_stale_exports(struct obd_device *obd) } spin_unlock(&obd->obd_dev_lock); - CDEBUG(D_ERROR, "%s: disconnecting %d stale clients\n", + CDEBUG(D_ERROR, "%s: disconnecting %d stale clients\n", obd->obd_name, cnt); class_disconnect_export_list(&work_list, get_exp_flags_from_obd(obd)); EXIT; @@ -994,7 +994,7 @@ static int ping_evictor_wake(struct obd_export *exp) #endif return 0; } - + #ifdef __KERNEL__ /* Same as ptlrpc_fail_export, but this module must load first... */ void ping_evictor_fail_export(struct obd_export *exp) @@ -1053,21 +1053,21 @@ static int ping_evictor_main(void *arg) (pet_state == PET_TERMINATE), &lwi); if (pet_state == PET_TERMINATE) break; - + obd = pet_exp->exp_obd; expire_time = CURRENT_SECONDS - (3 * obd_timeout / 2); - + CDEBUG(D_PET, "evicting all exports of obd %s older than %ld\n", obd->obd_name, expire_time); - - /* Exports can't be deleted out of the list, which means we - can't lose the last ref on the export, while we hold the obd + + /* Exports can't be deleted out of the list, which means we + can't lose the last ref on the export, while we hold the obd lock (class_unlink_export). If they've already been removed from the list, we won't find them here. */ spin_lock(&obd->obd_dev_lock); list_for_each_safe(pos, n, &obd->obd_exports_timed) { int stop = 0; - exp = list_entry(pos, struct obd_export, + exp = list_entry(pos, struct obd_export, exp_obd_chain_timed); class_export_get(exp); spin_unlock(&obd->obd_dev_lock); @@ -1075,27 +1075,26 @@ static int ping_evictor_main(void *arg) if (expire_time > exp->exp_last_request_time) { char ipbuf[PTL_NALFMT_SIZE]; struct ptlrpc_peer *peer; - - peer = exp->exp_connection - ? &exp->exp_connection->c_peer - : NULL; - + + peer = exp->exp_connection ? + &exp->exp_connection->c_peer : NULL; + if (peer && peer->peer_ni) { portals_nid2str(peer->peer_ni->pni_number, peer->peer_id.nid, ipbuf); } - + LCONSOLE_WARN("%s hasn't heard from %s in %ld " "seconds. I think it's dead, " "and I am evicting it.\n", obd->obd_name, - (peer && peer->peer_ni) - ? ipbuf - : (char *)exp->exp_client_uuid.uuid, - (long)(CURRENT_SECONDS - - exp->exp_last_request_time)); - + (peer && peer->peer_ni) ? + ipbuf : + (char *)exp->exp_client_uuid.uuid, + (long)(CURRENT_SECONDS - + exp->exp_last_request_time)); + ping_evictor_fail_export(exp); } else { /* List is sorted, so everyone below is ok */ @@ -1104,8 +1103,8 @@ static int ping_evictor_main(void *arg) class_export_put(exp); /* lock again for the next entry */ spin_lock(&obd->obd_dev_lock); - - if (stop) + + if (stop) break; } spin_unlock(&obd->obd_dev_lock); @@ -1116,7 +1115,7 @@ static int ping_evictor_main(void *arg) RETURN(0); } -#endif +#endif void ping_evictor_start(void) { @@ -1147,7 +1146,7 @@ void ping_evictor_stop(void) #endif } -/* This function makes sure dead exports are evicted in a timely manner. +/* This function makes sure dead exports are evicted in a timely manner. This function is only called when some export receives a message (i.e., the network is up.) */ void class_update_export_timer(struct obd_export *exp, time_t extra_delay) @@ -1159,8 +1158,8 @@ void class_update_export_timer(struct obd_export *exp, time_t extra_delay) /* Compensate for slow machines, etc, by faking our request time into the future. Although this can break the strict time-ordering of the list, we can be really lazy here - we don't have to evict - at the exact right moment. Eventually, all silent exports - will make it to the top of the list. */ + at the exact right moment. Eventually, all silent exports + will make it to the top of the list. */ exp->exp_last_request_time = max(exp->exp_last_request_time, (time_t)CURRENT_SECONDS + extra_delay); @@ -1168,7 +1167,7 @@ void class_update_export_timer(struct obd_export *exp, time_t extra_delay) exp->exp_client_uuid.uuid, exp->exp_last_request_time); - /* exports may get disconnected from the chain even though the + /* exports may get disconnected from the chain even though the export has references, so we must keep the spin lock while manipulating the lists */ spin_lock(&exp->exp_obd->obd_dev_lock); @@ -1179,19 +1178,19 @@ void class_update_export_timer(struct obd_export *exp, time_t extra_delay) return; } - list_move_tail(&exp->exp_obd_chain_timed, + list_move_tail(&exp->exp_obd_chain_timed, &exp->exp_obd->obd_exports_timed); oldest_exp = list_entry(exp->exp_obd->obd_exports_timed.next, struct obd_export, exp_obd_chain_timed); oldest_time = oldest_exp->exp_last_request_time; spin_unlock(&exp->exp_obd->obd_dev_lock); - - if (exp->exp_obd->obd_recoverable_clients > 0) + + if (exp->exp_obd->obd_recoverable_clients > 0) /* be nice to everyone during recovery */ return; /* Note - racing to start/reset the obd_eviction timer is safe */ - if (exp->exp_obd->obd_eviction_timer == 0) { + if (exp->exp_obd->obd_eviction_timer == 0) { /* Check if the oldest entry is expired. */ if (CURRENT_SECONDS > (oldest_time + (3 * obd_timeout / 2) + extra_delay)) { @@ -1199,7 +1198,7 @@ void class_update_export_timer(struct obd_export *exp, time_t extra_delay) down and it just came back. Since the pinger may skip every other PING_INTERVAL (see note in ptlrpc_pinger_main), we better wait for 3. */ - exp->exp_obd->obd_eviction_timer = CURRENT_SECONDS + + exp->exp_obd->obd_eviction_timer = CURRENT_SECONDS + 3 * PING_INTERVAL; CDEBUG(D_PET, "Thinking about evicting old export from %ld\n", diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 6c4b758..409964c 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -81,7 +81,7 @@ int class_attach(struct lustre_cfg *lcfg) len = strlen(name) + 1; OBD_ALLOC(namecopy, len); - if (!namecopy) + if (!namecopy) GOTO(out, rc = -ENOMEM); memcpy(namecopy, name, len); cleanup_phase = 2; /* free obd_name */ @@ -160,7 +160,7 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) CERROR("Device %d not attached\n", obd->obd_minor); RETURN(-ENODEV); } - + if (obd->obd_set_up) { CERROR("Device %d already setup (type %s)\n", obd->obd_minor, obd->obd_type->typ_name); @@ -177,7 +177,7 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) } /* just leave this on forever. I can't use obd_set_up here because other fns check that status, and we're not actually set up yet. */ - obd->obd_starting = 1; + obd->obd_starting = 1; spin_unlock(&obd->obd_dev_lock); exp = class_new_export(obd); @@ -199,10 +199,10 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) /* cleanup drops this */ atomic_inc(&obd->obd_refcount); spin_unlock(&obd->obd_dev_lock); - + CDEBUG(D_IOCTL, "finished setup of obd %s (uuid %s)\n", obd->obd_name, obd->obd_uuid.uuid); - + RETURN(0); err_exp: @@ -220,16 +220,16 @@ static int __class_detach(struct obd_device *obd) CDEBUG(D_CONFIG | D_WARNING, "destroying obd %d (%s)\n", obd->obd_minor, obd->obd_name); - if (OBP(obd, detach)) + if (OBP(obd, detach)) err = OBP(obd,detach)(obd); - + if (obd->obd_name) { OBD_FREE(obd->obd_name, strlen(obd->obd_name)+1); obd->obd_name = NULL; } else { CERROR("device %d: no name at detach\n", obd->obd_minor); } - + LASSERT(OBT(obd)); /* Attach took type refcount */ obd->obd_type->typ_refcnt--; @@ -255,7 +255,7 @@ int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg) } obd->obd_attached = 0; spin_unlock(&obd->obd_dev_lock); - + CDEBUG(D_IOCTL, "detach on obd %s (uuid %s)\n", obd->obd_name, obd->obd_uuid.uuid); @@ -333,14 +333,14 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) *flag); } } - + /* The three references that should be remaining are the * obd_self_export and the attach and setup references. */ if (atomic_read(&obd->obd_refcount) > 3) { if (!(obd->obd_fail || obd->obd_force)) { CERROR("OBD %s is still busy with %d references\n" "You should stop active file system users," - " or use the --force option to cleanup.\n", + " or use the --force option to cleanup.\n", obd->obd_name, atomic_read(&obd->obd_refcount)); dump_exports(obd); GOTO(out, err = -EBUSY); @@ -352,7 +352,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) } LASSERT(obd->obd_self_export); - + /* Precleanup stage 1, we must make sure all exports (other than the self-export) get destroyed. */ err = obd_precleanup(obd, 1); @@ -380,11 +380,11 @@ void class_decref(struct obd_device *obd) atomic_dec(&obd->obd_refcount); refs = atomic_read(&obd->obd_refcount); spin_unlock(&obd->obd_dev_lock); - + CDEBUG(D_INFO, "Decref %s now %d\n", obd->obd_name, refs); if ((refs == 1) && obd->obd_stopping) { - /* All exports (other than the self-export) have been + /* All exports (other than the self-export) have been destroyed; there should be no more in-progress ops by this point.*/ /* if we're not stopping, we didn't finish setup */ @@ -394,7 +394,7 @@ void class_decref(struct obd_device *obd) if (err) CERROR("Precleanup %s returned %d\n", obd->obd_name, err); - obd->obd_self_export->exp_flags |= + obd->obd_self_export->exp_flags |= (obd->obd_fail ? OBD_OPT_FAILOVER : 0) | (obd->obd_force ? OBD_OPT_FORCE : 0); /* note that we'll recurse into class_decref again */ @@ -617,7 +617,7 @@ int class_process_config(struct lustre_cfg *lcfg) lustre_cfg_string(lcfg, 1)); if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof obd_lustre_upcall) GOTO(out, err = -EINVAL); - strncpy(obd_lustre_upcall, lustre_cfg_string(lcfg, 1), + strncpy(obd_lustre_upcall, lustre_cfg_string(lcfg, 1), sizeof (obd_lustre_upcall)); GOTO(out, err = 0); } @@ -727,7 +727,7 @@ static int class_config_llog_handler(struct llog_handle * handle, struct portals_cfg *pcfg = (struct portals_cfg *)cfg_buf; if (pcfg->pcfg_version != PORTALS_CFG_VERSION) { if (pcfg->pcfg_version == __swab32(PORTALS_CFG_VERSION)) { - CDEBUG(D_OTHER, "swabbing portals_cfg %p\n", + CDEBUG(D_OTHER, "swabbing portals_cfg %p\n", pcfg); lustre_swab_portals_cfg(pcfg); } else { diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index f844b67..f8e29b0 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -123,11 +123,11 @@ static int dio_complete_routine(struct bio *bio, unsigned int done, int error) CERROR("***** bio->bi_private is NULL! This should never " "happen. Normally, I would crash here, but instead I " "will dump the bio contents to the console. Please " - "report this to CFS, along with any interesting messages " - "leading up to this point (like SCSI errors, perhaps). " - "Because bi_private is NULL, I can't wake up the thread " - "that initiated this I/O -- so you will probably have to " - "reboot this node."); + "report this to CFS, along with any interesting " + "messages leading up to this point (like SCSI errors, " + "perhaps). Because bi_private is NULL, I can't wake up " + "the thread that initiated this I/O -- so you will " + "probably have to reboot this node.\n"); CERROR("bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d, " "bi_idx: %d, bi->size: %d, bi_end_io: %p, bi_cnt: %d, " "bi_private: %p\n", bio->bi_next, bio->bi_flags, @@ -343,7 +343,7 @@ int filter_do_bio(struct obd_device *obd, struct inode *inode, record_finish_io(dreq, rw, rc); } } - + out: wait_event(dreq->dr_wait, atomic_read(&dreq->dr_numreqs) == 0); @@ -426,7 +426,7 @@ static int filter_quota_enforcement(struct obd_device *obd, cap_raise(uc->ouc_cap, CAP_SYS_RESOURCE); else cap_lower(uc->ouc_cap, CAP_SYS_RESOURCE); - + RETURN(0); } @@ -496,7 +496,7 @@ int filter_direct_io(int rw, struct dentry *dchild, void *iobuf, cap_raise(current->cap_effective, CAP_SYS_RESOURCE); dreq->dr_flag &= ~OBD_BRW_FROM_GRANT; } - + remap: rc = fsfilt_map_inode_pages(obd, inode, dreq->dr_pages, dreq->dr_npages, @@ -505,18 +505,18 @@ remap: rw == OBD_BRW_WRITE, NULL); if (rc == -EDQUOT) { - LASSERT(rw == OBD_BRW_WRITE && + LASSERT(rw == OBD_BRW_WRITE && !cap_raised(current->cap_effective, CAP_SYS_RESOURCE)); - /* Unfortunately, if quota master is too busy to handle the - * pre-dqacq in time or this user has exceeded quota limit, we - * have to wait for the completion of in flight dqacq/dqrel, + /* Unfortunately, if quota master is too busy to handle the + * pre-dqacq in time or this user has exceeded quota limit, we + * have to wait for the completion of in flight dqacq/dqrel, * then try again */ - if (qctxt_wait_on_dqacq(obd, qctxt, inode->i_uid, + if (qctxt_wait_on_dqacq(obd, qctxt, inode->i_uid, inode->i_gid, 1) == -EAGAIN) goto remap; } - + if (rw == OBD_BRW_WRITE) { if (rc == 0) { filter_tally_write(&obd->u.filter, diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index 2075c47..bf5a75f 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -91,7 +91,7 @@ void ptlrpc_run_failed_import_upcall(struct obd_import* imp) return; } spin_unlock_irqrestore(&imp->imp_lock, flags); - + argv[0] = obd_lustre_upcall; argv[1] = "FAILED_IMPORT"; argv[2] = imp->imp_target_uuid.uuid; @@ -108,8 +108,7 @@ void ptlrpc_run_failed_import_upcall(struct obd_import* imp) if (rc < 0) { CERROR("Error invoking recovery upcall %s %s %s %s %s %s: %d; " "check /proc/sys/lustre/lustre_upcall\n", - argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], rc); - + argv[0], argv[1], argv[2], argv[3], argv[4], argv[5],rc); } else { CWARN("Invoked upcall %s %s %s %s %s %s\n", argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); @@ -130,17 +129,15 @@ void ptlrpc_initiate_recovery(struct obd_import *imp) ENTRY; LASSERT (obd_lustre_upcall != NULL); - + if (strcmp(obd_lustre_upcall, "DEFAULT") == 0) { CDEBUG(D_HA, "%s: starting recovery without upcall\n", imp->imp_target_uuid.uuid); ptlrpc_connect_import(imp, NULL); - } - else if (strcmp(obd_lustre_upcall, "NONE") == 0) { + } else if (strcmp(obd_lustre_upcall, "NONE") == 0) { CDEBUG(D_HA, "%s: recovery disabled\n", imp->imp_target_uuid.uuid); - } - else { + } else { CDEBUG(D_HA, "%s: calling upcall to start recovery\n", imp->imp_target_uuid.uuid); ptlrpc_run_failed_import_upcall(imp); @@ -271,7 +268,6 @@ void ptlrpc_wake_delayed(struct obd_import *imp) void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req) { - int rc; struct obd_import *imp= failed_req->rq_import; unsigned long flags; ENTRY; @@ -290,8 +286,7 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req) imp->imp_obd->obd_name); ptlrpc_deactivate_import(imp); } - - rc = ptlrpc_connect_import(imp, NULL); + ptlrpc_connect_import(imp, NULL); } /* Wait for recovery to complete and resend. If evicted, then -- 1.8.3.1