removed cwd "./" (refer to Bugzilla 14399).
Severity : minor
+Bugzilla : 14929
+Description: Obsolete CURRENT_SECONDS and use cfs_time_current_sec() instead.
+
+Severity : minor
Bugzilla : 14645
Frequency : rare, on shutdown ost
Description: don't hit live lock with umount ost.
/* XXX */
#define LOOKUP_COBD 4096
-#define CURRENT_SECONDS cfs_unix_seconds()
#endif
#endif
-#ifndef CURRENT_SECONDS
-# define CURRENT_SECONDS time(0)
-#endif
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) ((sizeof (a))/(sizeof ((a)[0])))
if (req->rq_export == NULL && initial_conn)
export->exp_last_request_time =
max(export->exp_last_request_time,
- (time_t)CURRENT_SECONDS);
+ (time_t)cfs_time_current_sec());
}
/* We want to handle EALREADY but *not* -EALREADY from
CWARN("%s: connection from %s@%s %st"LPU64" exp %p cur %ld last %ld\n",
target->obd_name, cluuid.uuid, libcfs_nid2str(req->rq_peer.nid),
target->obd_recovering ? "recovering/" : "", data->ocd_transno,
- export, (long)CURRENT_SECONDS,
+ export, (long)cfs_time_current_sec(),
export ? (long)export->exp_last_request_time : 0);
rc < 0 ? "failed" : "complete", rc);
}
- obd->obd_recovery_end = CURRENT_SECONDS;
+ obd->obd_recovery_end = cfs_time_current_sec();
EXIT;
}
CDEBUG(D_HA, "%s: timer will expire in %u seconds\n", obd->obd_name,
(unsigned int)timeout_shift);
/* Only used for lprocfs_status */
- obd->obd_recovery_end = CURRENT_SECONDS + timeout_shift;
+ obd->obd_recovery_end = cfs_time_current_sec() + timeout_shift;
}
obd->obd_max_recoverable_clients, obd->obd_last_committed);
obd->obd_next_recovery_transno = obd->obd_last_committed + 1;
target_start_recovery_thread(obd, handler);
- obd->obd_recovery_start = CURRENT_SECONDS;
+ obd->obd_recovery_start = cfs_time_current_sec();
/* Only used for lprocfs_status */
obd->obd_recovery_end = obd->obd_recovery_start + OBD_RECOVERY_TIMEOUT;
/* bz13079: this should be set to desired value for ost but not for mds */
LDLM_ERROR(lock, "lock timed out (enqueued at %lu, %lus ago); "
"not entering recovery in server code, just going "
"back to sleep", lock->l_enqueued_time.tv_sec,
- CURRENT_SECONDS - lock->l_enqueued_time.tv_sec);
+ cfs_time_current_sec() - lock->l_enqueued_time.tv_sec);
if (cfs_time_after(cfs_time_current(), next_dump)) {
last_dump = next_dump;
next_dump = cfs_time_shift(300);
ptlrpc_fail_import(imp, lwd->lwd_conn_cnt);
LDLM_ERROR(lock, "lock timed out (enqueued at %lu, %lus ago), entering "
"recovery for %s@%s", lock->l_enqueued_time.tv_sec,
- CURRENT_SECONDS - lock->l_enqueued_time.tv_sec,
+ cfs_time_current_sec() - lock->l_enqueued_time.tv_sec,
obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
RETURN(0);
if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %lu\n",
LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
- CURRENT_SECONDS);
+ cfs_time_current_sec());
/* NB: ATTR_SIZE will only be set after this point if the size
* resides on the MDS, ie, this file has no objects. */
op_data->op_name = name;
op_data->op_namelen = namelen;
op_data->op_mode = mode;
- op_data->op_mod_time = CURRENT_SECONDS;
+ op_data->op_mod_time = cfs_time_current_sec();
op_data->op_fsuid = current->fsuid;
op_data->op_fsgid = current->fsgid;
op_data->op_cap = current->cap_effective;
if (!oqc)
RETURN(-ENOMEM);
- now = CURRENT_SECONDS;
+ now = cfs_time_current_sec();
if (cdqb->dqb_bsoftlimit &&
toqb(cdqb->dqb_curspace) >= cdqb->dqb_bsoftlimit &&
rc = mdd_xattr_set_txn(env, md2mdd_obj(obj), buf, name,
fl, handle);
if (rc == 0) {
- la_copy->la_ctime = CURRENT_SECONDS;
+ la_copy->la_ctime = cfs_time_current_sec();
la_copy->la_valid = LA_CTIME;
rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy,
handle, 0);
mdd_object_capa(env, mdd_obj));
mdd_write_unlock(env, mdd_obj);
if (rc == 0) {
- la_copy->la_ctime = CURRENT_SECONDS;
+ la_copy->la_ctime = cfs_time_current_sec();
la_copy->la_valid = LA_CTIME;
rc = mdd_attr_set_internal_locked(env, mdd_obj, la_copy,
handle, 0);
obd->obd_max_recoverable_clients, mds->mds_last_transno);
obd->obd_next_recovery_transno = obd->obd_last_committed + 1;
obd->obd_recovering = 1;
- obd->obd_recovery_start = CURRENT_SECONDS;
+ obd->obd_recovery_start = cfs_time_current_sec();
/* Only used for lprocfs_status */
obd->obd_recovery_end = obd->obd_recovery_start +
OBD_RECOVERY_TIMEOUT;
*/
int mds_fix_attr(struct inode *inode, struct mds_update_record *rec)
{
- time_t now = CURRENT_SECONDS;
+ time_t now = cfs_time_current_sec();
struct iattr *attr = &rec->ur_iattr;
unsigned int ia_valid = attr->ia_valid;
int error;
#define INODE_CTIME_AGE (10)
#define INODE_CTIME_OLD(inode) (LTIME_S(inode->i_ctime) + \
- INODE_CTIME_AGE < CURRENT_SECONDS)
+ INODE_CTIME_AGE < cfs_time_current_sec())
int mds_get_parent_child_locked(struct obd_device *obd, struct mds_obd *mds,
struct ll_fid *fid,
CFS_INIT_LIST_HEAD(&export->exp_handle.h_link);
class_handle_hash(&export->exp_handle, export_handle_addref);
- export->exp_last_request_time = CURRENT_SECONDS;
+ export->exp_last_request_time = cfs_time_current_sec();
spin_lock_init(&export->exp_lock);
INIT_HLIST_NODE(&export->exp_uuid_hash);
INIT_HLIST_NODE(&export->exp_nid_hash);
llh->llh_hdr.lrh_type = LLOG_HDR_MAGIC;
llh->llh_hdr.lrh_len = llh->llh_tail.lrt_len = LLOG_CHUNK_SIZE;
llh->llh_hdr.lrh_index = llh->llh_tail.lrt_index = 0;
- llh->llh_timestamp = CURRENT_SECONDS;
+ llh->llh_timestamp = cfs_time_current_sec();
if (uuid)
memcpy(&llh->llh_tgtuuid, uuid, sizeof(llh->llh_tgtuuid));
llh->llh_bitmap_offset = offsetof(typeof(*llh),llh_bitmap);
goto out;
if (lprocfs_obd_snprintf(&page, size, &len, "time remaining: %lu\n",
- CURRENT_SECONDS >= obd->obd_recovery_end ? 0 :
- obd->obd_recovery_end - CURRENT_SECONDS) <= 0)
+ cfs_time_current_sec() >= obd->obd_recovery_end ? 0 :
+ obd->obd_recovery_end - cfs_time_current_sec()) <= 0)
goto out;
if(lprocfs_obd_snprintf(&page, size, &len, "connected_clients: %d/%d\n",
aa->aa_resends++;
new_req->rq_interpret_reply = request->rq_interpret_reply;
new_req->rq_async_args = request->rq_async_args;
- new_req->rq_sent = CURRENT_SECONDS + aa->aa_resends;
+ new_req->rq_sent = cfs_time_current_sec() + aa->aa_resends;
new_aa = (struct osc_brw_async_args *)&new_req->rq_async_args;
spin_unlock(&capa_lock);
capa->lc_keyid = key->lk_keyid;
- capa->lc_expiry = CURRENT_SECONDS + dev->od_capa_timeout;
+ capa->lc_expiry = cfs_time_current_sec() + dev->od_capa_timeout;
rc = capa_hmac(capa->lc_hmac, capa, key->lk_key);
if (rc) {
ENTRY;
LASSERT(req->rq_phase == RQ_PHASE_NEW);
- if (req->rq_sent && (req->rq_sent > CURRENT_SECONDS))
+ if (req->rq_sent && (req->rq_sent > cfs_time_current_sec()))
RETURN (0);
req->rq_phase = RQ_PHASE_RPC;
RETURN(1);
} else {
/* here begins timeout counting */
- req->rq_sent = CURRENT_SECONDS;
+ req->rq_sent = cfs_time_current_sec();
req->rq_wait_ctx = 1;
RETURN(0);
}
}
if (!req->rq_wait_ctx) {
/* begins timeout counting */
- req->rq_sent = CURRENT_SECONDS;
+ req->rq_sent = cfs_time_current_sec();
req->rq_wait_ctx = 1;
}
continue;
DEBUG_REQ(D_ERROR|D_NETERROR, req, "%s (sent at %lu, %lus ago)",
req->rq_net_err ? "network error" : "timeout",
- (long)req->rq_sent, CURRENT_SECONDS - req->rq_sent);
+ (long)req->rq_sent, cfs_time_current_sec() - req->rq_sent);
if (imp != NULL && obd_debug_peer_on_timeout)
LNetCtl(IOC_LIBCFS_DEBUG_PEER, &imp->imp_connection->c_peer);
{
struct ptlrpc_request_set *set = data;
struct list_head *tmp;
- time_t now = CURRENT_SECONDS;
+ time_t now = cfs_time_current_sec();
ENTRY;
LASSERT(set != NULL);
int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set)
{
struct list_head *tmp;
- time_t now = CURRENT_SECONDS;
+ time_t now = cfs_time_current_sec();
time_t deadline;
int timeout = 0;
struct ptlrpc_request *req;
OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
- request->rq_sent = CURRENT_SECONDS;
+ request->rq_sent = cfs_time_current_sec();
do_gettimeofday(&request->rq_arrival_time);
ptlrpc_pinger_sending_on_import(request->rq_import);
rc = ptl_send_buf(&request->rq_req_md_h,
obd = pet_exp->exp_obd;
spin_unlock(&pet_lock);
- expire_time = CURRENT_SECONDS - (3 * obd_timeout / 2);
+ expire_time = cfs_time_current_sec() - (3 * obd_timeout / 2);
CDEBUG(D_HA, "evicting all exports of obd %s older than %ld\n",
obd->obd_name, expire_time);
obd->obd_name,
obd_uuid2str(&exp->exp_client_uuid),
obd_export_nid2str(exp),
- (long)(CURRENT_SECONDS -
+ (long)(cfs_time_current_sec() -
exp->exp_last_request_time),
- exp, (long)CURRENT_SECONDS,
+ exp, (long)cfs_time_current_sec(),
(long)expire_time,
(long)exp->exp_last_request_time);
CDEBUG(D_HA, "Last request was at %ld\n",
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);
+ cfs_time_current_sec() + extra_delay);
CDEBUG(D_HA, "updating export %s at %ld exp %p\n",
exp->exp_client_uuid.uuid,
/* Note - racing to start/reset the obd_eviction timer is safe */
if (exp->exp_obd->obd_eviction_timer == 0) {
/* Check if the oldest entry is expired. */
- if (CURRENT_SECONDS > (oldest_time +
+ if (cfs_time_current_sec() > (oldest_time +
(3 * obd_timeout / 2) + extra_delay)) {
/* We need a second timer, in case the net was 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 = cfs_time_current_sec() +
3 * PING_INTERVAL;
CDEBUG(D_HA, "%s: Think about evicting %s from %ld\n",
exp->exp_obd->obd_name, obd_export_nid2str(exp),
oldest_time);
}
} else {
- if (CURRENT_SECONDS > (exp->exp_obd->obd_eviction_timer +
+ if (cfs_time_current_sec() > (exp->exp_obd->obd_eviction_timer +
extra_delay)) {
/* The evictor won't evict anyone who we've heard from
* recently, so we don't have to check before we start