* Use is subject to license terms.
*/
/*
+ * Copyright (c) 2011 Whamcloud, Inc.
+ */
+/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
static int mdt_statfs(struct mdt_thread_info *info)
{
+ struct ptlrpc_request *req = mdt_info_req(info);
struct md_device *next = info->mti_mdt->mdt_child;
struct ptlrpc_service *svc;
struct obd_statfs *osfs;
&info->mti_u.ksfs);
statfs_pack(osfs, &info->mti_u.ksfs);
}
+
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_STATFS);
+
RETURN(rc);
}
static int mdt_getattr(struct mdt_thread_info *info)
{
+ struct ptlrpc_request *req = mdt_info_req(info);
struct mdt_object *obj = info->mti_object;
struct req_capsule *pill = info->mti_pill;
struct mdt_body *reqbody;
mdt_exit_ucred(info);
EXIT;
out_shrink:
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_GETATTR);
+
mdt_shrink_reply(info);
return rc;
}
}
static int mdt_sendpage(struct mdt_thread_info *info,
- struct lu_rdpg *rdpg)
+ struct lu_rdpg *rdpg, int nob)
{
struct ptlrpc_request *req = mdt_info_req(info);
struct obd_export *exp = req->rq_export;
struct l_wait_info *lwi = &info->mti_u.rdpg.mti_wait_info;
int tmpcount;
int tmpsize;
- int timeout;
int i;
int rc;
ENTRY;
if (desc == NULL)
RETURN(-ENOMEM);
- for (i = 0, tmpcount = rdpg->rp_count;
- i < rdpg->rp_npages; i++, tmpcount -= tmpsize) {
+ for (i = 0, tmpcount = nob;
+ i < rdpg->rp_npages && tmpcount > 0; i++, tmpcount -= tmpsize) {
tmpsize = min_t(int, tmpcount, CFS_PAGE_SIZE);
ptlrpc_prep_bulk_page(desc, rdpg->rp_pages[i], 0, tmpsize);
}
- LASSERT(desc->bd_nob == rdpg->rp_count);
- rc = sptlrpc_svc_wrap_bulk(req, desc);
- if (rc)
- GOTO(free_desc, rc);
-
- rc = ptlrpc_start_bulk_transfer(desc);
- if (rc)
- GOTO(free_desc, rc);
-
- if (OBD_FAIL_CHECK(OBD_FAIL_MDS_SENDPAGE))
- GOTO(abort_bulk, rc = 0);
-
- do {
- timeout = (int) req->rq_deadline - cfs_time_current_sec();
- if (timeout < 0)
- CERROR("Req deadline already passed %lu (now: %lu)\n",
- req->rq_deadline, cfs_time_current_sec());
- *lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(max(timeout, 1)),
- cfs_time_seconds(1), NULL, NULL);
- rc = l_wait_event(desc->bd_waitq,
- !ptlrpc_server_bulk_active(desc) ||
- exp->exp_failed ||
- exp->exp_abort_active_req, lwi);
- LASSERT (rc == 0 || rc == -ETIMEDOUT);
- } while ((rc == -ETIMEDOUT) &&
- (req->rq_deadline > cfs_time_current_sec()));
-
- if (rc == 0) {
- if (desc->bd_success &&
- desc->bd_nob_transferred == rdpg->rp_count)
- GOTO(free_desc, rc);
-
- rc = -ETIMEDOUT;
- if (exp->exp_abort_active_req || exp->exp_failed)
- GOTO(abort_bulk, rc);
- }
-
- DEBUG_REQ(D_ERROR, req, "bulk failed: %s %d(%d), evicting %s@%s",
- (rc == -ETIMEDOUT) ? "timeout" : "network error",
- desc->bd_nob_transferred, rdpg->rp_count,
- exp->exp_client_uuid.uuid,
- exp->exp_connection->c_remote_uuid.uuid);
-
- class_fail_export(exp);
-
- EXIT;
-abort_bulk:
- ptlrpc_abort_bulk(desc);
-free_desc:
+ LASSERT(desc->bd_nob == nob);
+ rc = target_bulk_io(exp, desc, lwi);
ptlrpc_free_bulk(desc);
- return rc;
+ RETURN(rc);
}
#ifdef HAVE_SPLIT_SUPPORT
rdpg->rp_attrs = reqbody->mode;
if (info->mti_exp->exp_connect_flags & OBD_CONNECT_64BITHASH)
rdpg->rp_attrs |= LUDA_64BITHASH;
- rdpg->rp_count = reqbody->nlink;
- rdpg->rp_npages = (rdpg->rp_count + CFS_PAGE_SIZE - 1)>>CFS_PAGE_SHIFT;
+ rdpg->rp_count = min_t(unsigned int, reqbody->nlink,
+ PTLRPC_MAX_BRW_SIZE);
+ rdpg->rp_npages = (rdpg->rp_count + CFS_PAGE_SIZE - 1) >>
+ CFS_PAGE_SHIFT;
OBD_ALLOC(rdpg->rp_pages, rdpg->rp_npages * sizeof rdpg->rp_pages[0]);
if (rdpg->rp_pages == NULL)
RETURN(-ENOMEM);
/* call lower layers to fill allocated pages with directory data */
rc = mo_readpage(info->mti_env, mdt_object_child(object), rdpg);
- if (rc)
+ if (rc < 0)
GOTO(free_rdpg, rc);
/* send pages to client */
- rc = mdt_sendpage(info, rdpg);
+ rc = mdt_sendpage(info, rdpg, rc);
EXIT;
free_rdpg:
static int mdt_sync(struct mdt_thread_info *info)
{
+ struct ptlrpc_request *req = mdt_info_req(info);
struct req_capsule *pill = info->mti_pill;
struct mdt_body *body;
int rc;
} else
rc = err_serious(rc);
}
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_SYNC);
+
RETURN(rc);
}
}
rep->lock_policy_res2 = clear_serious(rc);
+ if (rep->lock_policy_res2 == -ENOENT &&
+ mdt_get_disposition(rep, DISP_LOOKUP_NEG))
+ rep->lock_policy_res2 = 0;
+
if (rc == -ENOTCONN || rc == -ENODEV ||
rc == -EOVERFLOW) { /**< if VBR failure then return error */
/*
CERROR("CMD Operation not allowed in IOP mode\n");
GOTO(err_lmi, rc = -EINVAL);
}
- /* Read recovery timeouts */
- if (lsi->lsi_lmd && lsi->lsi_lmd->lmd_recovery_time_soft)
- obd->obd_recovery_timeout =
- lsi->lsi_lmd->lmd_recovery_time_soft;
- if (lsi->lsi_lmd && lsi->lsi_lmd->lmd_recovery_time_hard)
- obd->obd_recovery_time_hard =
- lsi->lsi_lmd->lmd_recovery_time_hard;
+ obd->u.obt.obt_magic = OBT_MAGIC;
}
cfs_rwlock_init(&m->mdt_sptlrpc_lock);
/*
* For interoperability between 1.8 and 2.0,
- * skip old "mdt.group_upcall" param.
*/
{
+ /* Skip old "mdt.group_upcall" param. */
char *param = lustre_cfg_string(cfg, 1);
if (param && !strncmp("mdt.group_upcall", param, 16)) {
CWARN("For 1.8 interoperability, skip this"
" mdt.group_upcall. It is obsolete\n");
break;
}
+ /* Rename old "mdt.quota_type" to "mdd.quota_type. */
+ if (param && !strncmp("mdt.quota_type", param, 14)) {
+ CWARN("Found old param mdt.quota_type, changed"
+ " it to mdd.quota_type.\n");
+ param[2] = 'd';
+ }
}
lprocfs_mdt_init_vars(&lvars);
if (!mdt->mdt_som_conf)
data->ocd_connect_flags &= ~OBD_CONNECT_SOM;
+ if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) {
+ data->ocd_brw_size = min(data->ocd_brw_size,
+ (__u32)(PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT));
+ if (data->ocd_brw_size == 0) {
+ CERROR("%s: cli %s/%p ocd_connect_flags: "LPX64
+ " ocd_version: %x ocd_grant: %d "
+ "ocd_index: %u ocd_brw_size is "
+ "unexpectedly zero, network data "
+ "corruption? Refusing connection of this"
+ " client\n",
+ exp->exp_obd->obd_name,
+ exp->exp_client_uuid.uuid,
+ exp, data->ocd_connect_flags, data->ocd_version,
+ data->ocd_grant, data->ocd_index);
+ return -EPROTO;
+ }
+ }
+
cfs_spin_lock(&exp->exp_lock);
exp->exp_connect_flags = data->ocd_connect_flags;
cfs_spin_unlock(&exp->exp_lock);
RETURN(rc);
}
-static int mdt_obd_notify(struct obd_device *host,
+static int mdt_obd_notify(struct obd_device *obd,
struct obd_device *watched,
enum obd_notify_event ev, void *data)
{
- struct mdt_device *mdt = mdt_dev(host->obd_lu_dev);
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
#ifdef HAVE_QUOTA_SUPPORT
struct md_device *next = mdt->mdt_child;
#endif
struct mdt_lock_handle *lh;
int rc;
ENTRY;
+
CDEBUG(D_IOCTL, "getting version for "DFID"\n", PFID(fid));
if (!fid_is_sane(fid))
RETURN(-EINVAL);
* fid, this is error to find remote object here
*/
CERROR("nonlocal object "DFID"\n", PFID(fid));
+ } else if (rc == 0) {
+ *(__u64 *)data->ioc_inlbuf2 = ENOENT_VERSION;
+ rc = -ENOENT;
} else {
version = mo_version_get(mti->mti_env, mdt_object_child(obj));
*(__u64 *)data->ioc_inlbuf2 = version;