-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* Author: Phil Schwan <phil@clusterfs.com>
*/
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
#define DEBUG_SUBSYSTEM S_OST
#include <linux/module.h>
memcpy(&repbody->oa, &body->oa, sizeof(body->oa));
/* Do the destroy and set the reply status accordingly */
- req->rq_status = obd_destroy(exp, &repbody->oa, NULL, oti, NULL, capa);
+ req->rq_status = obd_destroy(req->rq_svc_thread->t_env, exp,
+ &repbody->oa, NULL, oti, NULL, capa);
RETURN(0);
}
oinfo->oi_oa = &repbody->oa;
oinfo->oi_capa = capa;
- req->rq_status = obd_getattr(exp, oinfo);
+ req->rq_status = obd_getattr(req->rq_svc_thread->t_env, exp, oinfo);
OBD_FREE_PTR(oinfo);
osfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS);
- req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
+ req->rq_status = obd_statfs(req->rq_svc_thread->t_env, req->rq_export,
+ osfs,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
0);
if (req->rq_status != 0)
repbody->oa = body->oa;
oti->oti_logcookies = &body->oa.o_lcookie;
- req->rq_status = obd_create(exp, &repbody->oa, NULL, oti);
+ req->rq_status = obd_create(req->rq_svc_thread->t_env, exp,
+ &repbody->oa, NULL, oti);
//obd_log_cancel(conn, NULL, 1, oti->oti_logcookies, 0);
RETURN(0);
}
oinfo->oi_capa = capa;
oinfo->oi_flags = OBD_FL_PUNCH;
- req->rq_status = obd_punch(exp, oinfo, oti, NULL);
+ req->rq_status = obd_punch(req->rq_svc_thread->t_env, exp,
+ oinfo, oti, NULL);
OBD_FREE_PTR(oinfo);
unlock:
ost_lock_put(exp, &lh, LCK_PW);
RETURN(rc);
}
-static int ost_sync(struct obd_export *exp, struct ptlrpc_request *req)
+static int ost_sync(struct obd_export *exp, struct ptlrpc_request *req,
+ struct obd_trans_info *oti)
{
struct ost_body *body, *repbody;
struct obd_info *oinfo;
oinfo->oi_oa = &repbody->oa;
oinfo->oi_capa = capa;
- req->rq_status = obd_sync(exp, oinfo, repbody->oa.o_size,
- repbody->oa.o_blocks, NULL);
+ oinfo->oi_jobid = oti->oti_jobid;
+ req->rq_status = obd_sync(req->rq_svc_thread->t_env, exp, oinfo,
+ repbody->oa.o_size, repbody->oa.o_blocks,
+ NULL);
OBD_FREE_PTR(oinfo);
ost_drop_id(exp, &repbody->oa);
oinfo->oi_oa = &repbody->oa;
oinfo->oi_capa = capa;
- req->rq_status = obd_setattr(exp, oinfo, oti);
+ req->rq_status = obd_setattr(req->rq_svc_thread->t_env, exp, oinfo,
+ oti);
OBD_FREE_PTR(oinfo);
}
static __u32 ost_checksum_bulk(struct ptlrpc_bulk_desc *desc, int opc,
- cksum_type_t cksum_type)
+ cksum_type_t cksum_type)
{
- __u32 cksum;
- int i;
-
- cksum = init_checksum(cksum_type);
- for (i = 0; i < desc->bd_iov_count; i++) {
- struct page *page = desc->bd_iov[i].kiov_page;
- int off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
- char *ptr = kmap(page) + off;
- int len = desc->bd_iov[i].kiov_len;
-
- /* corrupt the data before we compute the checksum, to
- * simulate a client->OST data error */
- if (i == 0 && opc == OST_WRITE &&
- OBD_FAIL_CHECK(OBD_FAIL_OST_CHECKSUM_RECEIVE))
- memcpy(ptr, "bad3", min(4, len));
- cksum = compute_checksum(cksum, ptr, len, cksum_type);
- /* corrupt the data after we compute the checksum, to
- * simulate an OST->client data error */
- if (i == 0 && opc == OST_READ &&
- OBD_FAIL_CHECK(OBD_FAIL_OST_CHECKSUM_SEND)) {
- memcpy(ptr, "bad4", min(4, len));
- /* nobody should use corrupted page again */
- ClearPageUptodate(page);
- }
- kunmap(page);
- }
-
- return fini_checksum(cksum, cksum_type);
+ struct cfs_crypto_hash_desc *hdesc;
+ unsigned int bufsize;
+ int i, err;
+ unsigned char cfs_alg = cksum_obd2cfs(cksum_type);
+ __u32 cksum;
+
+ hdesc = cfs_crypto_hash_init(cfs_alg, NULL, 0);
+ if (IS_ERR(hdesc)) {
+ CERROR("Unable to initialize checksum hash %s\n",
+ cfs_crypto_hash_name(cfs_alg));
+ return PTR_ERR(hdesc);
+ }
+ CDEBUG(D_INFO, "Checksum for algo %s\n", cfs_crypto_hash_name(cfs_alg));
+ for (i = 0; i < desc->bd_iov_count; i++) {
+
+ /* corrupt the data before we compute the checksum, to
+ * simulate a client->OST data error */
+ if (i == 0 && opc == OST_WRITE &&
+ OBD_FAIL_CHECK(OBD_FAIL_OST_CHECKSUM_RECEIVE)) {
+ int off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
+ int len = desc->bd_iov[i].kiov_len;
+ char *ptr = kmap(desc->bd_iov[i].kiov_page) + off;
+ memcpy(ptr, "bad3", min(4, len));
+ kunmap(desc->bd_iov[i].kiov_page);
+ }
+ cfs_crypto_hash_update_page(hdesc, desc->bd_iov[i].kiov_page,
+ desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK,
+ desc->bd_iov[i].kiov_len);
+
+ /* corrupt the data after we compute the checksum, to
+ * simulate an OST->client data error */
+ if (i == 0 && opc == OST_READ &&
+ OBD_FAIL_CHECK(OBD_FAIL_OST_CHECKSUM_SEND)) {
+ int off = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
+ int len = desc->bd_iov[i].kiov_len;
+ char *ptr = kmap(desc->bd_iov[i].kiov_page) + off;
+ memcpy(ptr, "bad4", min(4, len));
+ kunmap(desc->bd_iov[i].kiov_page);
+ /* nobody should use corrupted page again */
+ ClearPageUptodate(desc->bd_iov[i].kiov_page);
+ }
+ }
+
+ bufsize = 4;
+ err = cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize);
+ if (err)
+ cfs_crypto_hash_final(hdesc, NULL, NULL);
+
+ return cksum;
}
static int ost_brw_lock_get(int mode, struct obd_export *exp,
memcpy(&repbody->oa, &body->oa, sizeof(repbody->oa));
npages = OST_THREAD_POOL_SIZE;
- rc = obd_preprw(OBD_BRW_READ, exp, &repbody->oa, 1, ioo,
- remote_nb, &npages, local_nb, oti, capa);
+ rc = obd_preprw(req->rq_svc_thread->t_env, OBD_BRW_READ, exp,
+ &repbody->oa, 1, ioo, remote_nb, &npages, local_nb,
+ oti, capa);
if (rc != 0)
GOTO(out_lock, rc);
out_commitrw:
/* Must commit after prep above in all cases */
- rc = obd_commitrw(OBD_BRW_READ, exp, &repbody->oa, 1, ioo,
- remote_nb, npages, local_nb, oti, rc);
+ rc = obd_commitrw(req->rq_svc_thread->t_env, OBD_BRW_READ, exp,
+ &repbody->oa, 1, ioo, remote_nb, npages, local_nb,
+ oti, rc);
if (rc == 0)
ost_drop_id(exp, &repbody->oa);
memcpy(&repbody->oa, &body->oa, sizeof(repbody->oa));
npages = OST_THREAD_POOL_SIZE;
- rc = obd_preprw(OBD_BRW_WRITE, exp, &repbody->oa, objcount,
- ioo, remote_nb, &npages, local_nb, oti, capa);
+ rc = obd_preprw(req->rq_svc_thread->t_env, OBD_BRW_WRITE, exp,
+ &repbody->oa, objcount, ioo, remote_nb, &npages,
+ local_nb, oti, capa);
if (rc != 0)
GOTO(out_lock, rc);
}
/* Must commit after prep above in all cases */
- rc = obd_commitrw(OBD_BRW_WRITE, exp, &repbody->oa, objcount, ioo,
- remote_nb, npages, local_nb, oti, rc);
+ rc = obd_commitrw(req->rq_svc_thread->t_env, OBD_BRW_WRITE, exp,
+ &repbody->oa, objcount, ioo, remote_nb, npages,
+ local_nb, oti, rc);
if (rc == -ENOTCONN)
/* quota acquire process has been given up because
* either the client has been evicted or the client
/* OBD will also check if KEY_IS(KEY_GRANT_SHRINK), and will cast val to
* a struct ost_body * value */
- rc = obd_set_info_async(exp, keylen, key, vallen, val, NULL);
+ rc = obd_set_info_async(req->rq_svc_thread->t_env, exp, keylen,
+ key, vallen, val, NULL);
out:
lustre_msg_set_status(req->rq_repmsg, 0);
RETURN(rc);
RETURN(rc);
}
- rc = obd_get_info(exp, keylen, key, &replylen, NULL, NULL);
+ rc = obd_get_info(req->rq_svc_thread->t_env, exp, keylen, key,
+ &replylen, NULL, NULL);
if (rc)
RETURN(rc);
RETURN(-ENOMEM);
/* call again to fill in the reply buffer */
- rc = obd_get_info(exp, keylen, key, &replylen, reply, NULL);
+ rc = obd_get_info(req->rq_svc_thread->t_env, exp, keylen, key,
+ &replylen, reply, NULL);
lustre_msg_set_status(req->rq_repmsg, 0);
RETURN(rc);
int rc = 0;
ENTRY;
- rc = obd_get_info(lock->l_export, sizeof(KEY_SYNC_LOCK_CANCEL),
+ rc = obd_get_info(NULL, lock->l_export, sizeof(KEY_SYNC_LOCK_CANCEL),
KEY_SYNC_LOCK_CANCEL, &len, &sync_lock_cancel, NULL);
if (!rc && flag == LDLM_CB_CANCELING &&
oa->o_valid = OBD_MD_FLID|OBD_MD_FLGROUP;
oinfo->oi_oa = oa;
- rc = obd_sync(lock->l_export, oinfo,
+ rc = obd_sync(NULL, lock->l_export, oinfo,
lock->l_policy_data.l_extent.start,
lock->l_policy_data.l_extent.end, NULL);
if (rc)
static void ost_prolong_lock_one(struct ost_prolong_data *opd,
struct ldlm_lock *lock)
{
- LASSERT(lock->l_req_mode == lock->l_granted_mode);
- LASSERT(lock->l_export == opd->opd_exp);
+ LASSERT(lock->l_export == opd->opd_exp);
+
+ if (lock->l_destroyed) /* lock already cancelled */
+ return;
/* XXX: never try to grab resource lock here because we're inside
* exp_bl_list_lock; in ldlm_lockd.c to handle waiting list we take
struct obd_device *obd = NULL;
ENTRY;
+ /* OST module is kept between remounts, but the last reference
+ * to specific module (say, osd or ofd) kills all related keys
+ * from the environment. so we have to refill it until the root
+ * cause is fixed properly */
+ lu_env_refill(req->rq_svc_thread->t_env);
+
LASSERT(current->journal_info == NULL);
/* primordial rpcs don't affect server recovery */
if (rc)
RETURN(rc);
+ if (req && req->rq_reqmsg && req->rq_export &&
+ (req->rq_export->exp_connect_flags & OBD_CONNECT_JOBSTATS))
+ oti->oti_jobid = lustre_msg_get_jobid(req->rq_reqmsg);
+
switch (lustre_msg_get_opc(req->rq_reqmsg)) {
case OST_CONNECT: {
CDEBUG(D_INODE, "connect\n");
req_capsule_set(&req->rq_pill, &RQF_OST_SYNC);
if (OBD_FAIL_CHECK(OBD_FAIL_OST_SYNC_NET))
RETURN(0);
- rc = ost_sync(req->rq_export, req);
+ rc = ost_sync(req->rq_export, req, oti);
break;
case OST_SET_INFO:
DEBUG_REQ(D_INODE, req, "set_info");
if (oss_num_threads < OSS_THREADS_MIN)
oss_num_threads = OSS_THREADS_MIN;
oss_max_threads = oss_min_threads = oss_num_threads;
- } else {
- /* Base min threads on memory and cpus */
- oss_min_threads =
- cfs_num_possible_cpus() * CFS_NUM_CACHEPAGES >>
- (27 - CFS_PAGE_SHIFT);
- if (oss_min_threads < OSS_THREADS_MIN)
- oss_min_threads = OSS_THREADS_MIN;
- /* Insure a 4x range for dynamic threads */
- if (oss_min_threads > OSS_THREADS_MAX / 4)
- oss_min_threads = OSS_THREADS_MAX / 4;
- oss_max_threads = min(OSS_THREADS_MAX, oss_min_threads * 4 + 1);
- }
+ } else {
+ /* Base min threads on memory and cpus */
+ oss_min_threads =
+ cfs_num_online_cpus() * CFS_NUM_CACHEPAGES >>
+ (27 - CFS_PAGE_SHIFT);
+ if (oss_min_threads < OSS_THREADS_MIN)
+ oss_min_threads = OSS_THREADS_MIN;
+ /* Insure a 4x range for dynamic threads */
+ if (oss_min_threads > OSS_THREADS_MAX / 4)
+ oss_min_threads = OSS_THREADS_MAX / 4;
+ oss_max_threads = min(OSS_THREADS_MAX, oss_min_threads * 4 + 1);
+ }
ost->ost_service =
ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
RETURN(err);
}
-static int ost_health_check(struct obd_device *obd)
+static int ost_health_check(const struct lu_env *env, struct obd_device *obd)
{
struct ost_obd *ost = &obd->u.ost;
int rc = 0;