Comments and other purely cosmetic fixes.
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 *);
{
int rc;
ENTRY;
-
- OBD_CHECK_DEV(obd);
+
+ OBD_CHECK_DEV(obd);
OBD_CHECK_OP(obd, cleanup, 0);
OBD_COUNTER_INCREMENT(obd, cleanup);
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;
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);
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));
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;
}
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");
{
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)
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);
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);
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) {
}
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;
#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)
(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);
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 */
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);
RETURN(0);
}
-#endif
+#endif
void ping_evictor_start(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)
/* 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);
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);
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)) {
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",
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 */
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);
}
/* 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);
/* 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:
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--;
}
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);
*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);
}
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);
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 */
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 */
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);
}
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 {
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,
record_finish_io(dreq, rw, rc);
}
}
-
+
out:
wait_event(dreq->dr_wait, atomic_read(&dreq->dr_numreqs) == 0);
cap_raise(uc->ouc_cap, CAP_SYS_RESOURCE);
else
cap_lower(uc->ouc_cap, CAP_SYS_RESOURCE);
-
+
RETURN(0);
}
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,
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,
return;
}
spin_unlock_irqrestore(&imp->imp_lock, flags);
-
+
argv[0] = obd_lustre_upcall;
argv[1] = "FAILED_IMPORT";
argv[2] = imp->imp_target_uuid.uuid;
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]);
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);
void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
{
- int rc;
struct obd_import *imp= failed_req->rq_import;
unsigned long flags;
ENTRY;
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