Commit 50ffcb7e authored by Mike Rapoport's avatar Mike Rapoport Committed by Greg Kroah-Hartman

staging: lustre: add missing blank line after declarations

Fixes checkpatch.pl WARNING:LINE_SPACING: Missing a blank line after
declarations.
The patch is generated using checkpatch.pl --fix-inplace:

for f in $(find drivers/staging/lustre/ -type f) ; do
    ./scripts/checkpatch.pl --types "LINE_SPACING" --test-only=Missing \
    --fix-inplace -f $f
done
Signed-off-by: default avatarMike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3fd624b3
......@@ -2154,6 +2154,7 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob)
unsigned long flags;
int rc;
struct sockaddr_in *peer_addr;
LASSERT(!in_interrupt());
/* cmid inherits 'context' from the corresponding listener id */
......@@ -2169,6 +2170,7 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob)
if (*kiblnd_tunables.kib_require_priv_port &&
ntohs(peer_addr->sin_port) >= PROT_SOCK) {
__u32 ip = ntohl(peer_addr->sin_addr.s_addr);
CERROR("Peer's port (%pI4h:%hu) is not privileged\n",
&ip, ntohs(peer_addr->sin_port));
goto failed;
......
......@@ -2440,6 +2440,7 @@ ksocknal_base_startup(void)
for (i = 0; i < *ksocknal_tunables.ksnd_nconnds; i++) {
char name[16];
spin_lock_bh(&ksocknal_data.ksnd_connd_lock);
ksocknal_data.ksnd_connd_starting++;
spin_unlock_bh(&ksocknal_data.ksnd_connd_lock);
......@@ -2705,6 +2706,7 @@ ksocknal_start_schedulers(struct ksock_sched_info *info)
long id;
char name[20];
ksock_sched_t *sched;
id = KSOCK_THREAD_ID(info->ksi_cpt, info->ksi_nthreads + i);
sched = &info->ksi_scheds[KSOCK_THREAD_SID(id)];
snprintf(name, sizeof(name), "socknal_sd%02d_%02d",
......
......@@ -299,6 +299,7 @@ ksocknal_recv_kiov (ksock_conn_t *conn)
lnet_kiov_t *kiov = conn->ksnc_rx_kiov;
int nob;
int rc;
LASSERT(conn->ksnc_rx_nkiov > 0);
/* Never touch conn->ksnc_rx_kiov or change connection
......@@ -2240,6 +2241,7 @@ ksocknal_find_timed_out_conn (ksock_peer_t *peer)
list_for_each (ctmp, &peer->ksnp_conns) {
int error;
conn = list_entry (ctmp, ksock_conn_t, ksnc_list);
/* Don't need the {get,put}connsock dance to deref ksnc_sock */
......
......@@ -70,6 +70,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,
const char *func, int line)
{
unsigned long cur = jiffies;
while (1) {
if (spin_trylock(&lock->lock)) {
LASSERT(lock->task == NULL);
......
......@@ -1006,6 +1006,7 @@ static inline int lu_dirent_calc_size(int namelen, __u16 attr)
if (attr & LUDA_TYPE) {
const unsigned align = sizeof(struct luda_type) - 1;
size = (sizeof(struct lu_dirent) + namelen + align) & ~align;
size += sizeof(struct luda_type);
} else
......
......@@ -447,6 +447,7 @@ static inline char *obd_uuid2str(const struct obd_uuid *uuid)
/* Obviously not safe, but for printfs, no real harm done...
we're always null-terminated, even in a race. */
static char temp[sizeof(*uuid)];
memcpy(temp, uuid->uuid, sizeof(*uuid) - 1);
temp[sizeof(*uuid) - 1] = '\0';
return temp;
......
......@@ -157,6 +157,7 @@ static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index)
int i;
int offset;
int bufcount;
LASSERT (lcfg != NULL);
LASSERT (index >= 0);
......@@ -174,6 +175,7 @@ static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs,
struct lustre_cfg *lcfg)
{
int i;
bufs->lcfg_bufcount = lcfg->lcfg_bufcount;
for (i = 0; i < bufs->lcfg_bufcount; i++) {
bufs->lcfg_buflen[i] = lcfg->lcfg_buflens[i];
......@@ -200,6 +202,7 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)
int last = min((int)lcfg->lcfg_buflens[index],
cfs_size_round(lcfg->lcfg_buflens[index]) - 1);
char lost = s[last];
s[last] = '\0';
if (lost != '\0') {
CWARN("Truncated buf %d to '%s' (lost '%c'...)\n",
......
......@@ -223,6 +223,7 @@ static inline void check_lcd(char *obd_name, int index,
struct lsd_client_data *lcd)
{
int length = sizeof(lcd->lcd_uuid);
if (strnlen((char *)lcd->lcd_uuid, length) == length) {
lcd->lcd_uuid[length - 1] = '\0';
......@@ -236,6 +237,7 @@ static inline void lsd_le_to_cpu(struct lr_server_data *buf,
struct lr_server_data *lsd)
{
int i;
memcpy(lsd->lsd_uuid, buf->lsd_uuid, sizeof(lsd->lsd_uuid));
lsd->lsd_last_transno = le64_to_cpu(buf->lsd_last_transno);
lsd->lsd_compat14 = le64_to_cpu(buf->lsd_compat14);
......@@ -263,6 +265,7 @@ static inline void lsd_cpu_to_le(struct lr_server_data *lsd,
struct lr_server_data *buf)
{
int i;
memcpy(buf->lsd_uuid, lsd->lsd_uuid, sizeof(buf->lsd_uuid));
buf->lsd_last_transno = cpu_to_le64(lsd->lsd_last_transno);
buf->lsd_compat14 = cpu_to_le64(lsd->lsd_compat14);
......
......@@ -532,6 +532,7 @@ static inline void ost_fid_build_resid(const struct lu_fid *fid,
{
if (fid_is_mdt0(fid) || fid_is_idif(fid)) {
struct ost_id oi;
oi.oi.oi_id = 0; /* gcc 4.7.2 complains otherwise */
if (fid_to_ostid(fid, &oi) != 0)
return;
......@@ -547,6 +548,7 @@ static inline void ost_fid_from_resid(struct lu_fid *fid,
if (fid_seq_is_mdt0(name->name[LUSTRE_RES_ID_VER_OID_OFF])) {
/* old resid */
struct ost_id oi;
ostid_set_seq(&oi, name->name[LUSTRE_RES_ID_VER_OID_OFF]);
ostid_set_id(&oi, name->name[LUSTRE_RES_ID_SEQ_OFF]);
ostid_to_fid(fid, &oi, 0);
......
......@@ -177,6 +177,7 @@ struct obd_ioctl_hdr {
static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
{
int len = cfs_size_round(sizeof(struct obd_ioctl_data));
len += cfs_size_round(data->ioc_inllen1);
len += cfs_size_round(data->ioc_inllen2);
len += cfs_size_round(data->ioc_inllen3);
......
......@@ -486,6 +486,7 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
if (ldt != NULL) {
struct lu_context session_ctx;
struct lu_env env;
lu_context_init(&session_ctx, LCT_SESSION);
session_ctx.lc_thread = NULL;
lu_context_enter(&session_ctx);
......@@ -577,6 +578,7 @@ static inline void obd_cleanup_client_import(struct obd_device *obd)
down_write(&obd->u.cli.cl_sem);
if (obd->u.cli.cl_import) {
struct obd_import *imp;
imp = obd->u.cli.cl_import;
CDEBUG(D_CONFIG, "%s: client import never connected\n",
obd->obd_name);
......
......@@ -224,6 +224,7 @@ static void cfs_crypto_performance_test(unsigned char alg_id,
cfs_crypto_hash_name(alg_id), err);
} else {
unsigned long tmp;
tmp = ((bcount * buf_len / jiffies_to_msecs(end - start)) *
1000) / (1024 * 1024);
cfs_crypto_hash_speeds[alg_id] = (int)tmp;
......
......@@ -91,6 +91,7 @@ static void cfs_kernel_cap_pack(kernel_cap_t kcap, cfs_cap_t *cap)
cfs_cap_t cfs_curproc_cap_pack(void)
{
cfs_cap_t cap;
cfs_kernel_cap_pack(current_cap(), &cap);
return cap;
}
......
......@@ -293,6 +293,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
default: {
struct libcfs_ioctl_handler *hand;
err = -EINVAL;
down_read(&ioctl_list_sem);
list_for_each_entry(hand, &ioctl_list, item) {
......
......@@ -652,6 +652,7 @@ void cfs_trace_debug_print(void)
while (p < ((char *)page_address(page) + tage->used)) {
struct ptldebug_header *hdr;
int len;
hdr = (void *)p;
p += sizeof(*hdr);
file = p;
......
......@@ -995,6 +995,7 @@ static inline struct obd_export *ll_s2mdexp(struct super_block *sb)
static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi)
{
struct obd_device *obd = sbi->ll_md_exp->exp_obd;
if (obd == NULL)
LBUG();
return &obd->u.cli;
......
......@@ -49,6 +49,7 @@
__u32 get_uuid2int(const char *name, int len)
{
__u32 key0 = 0x12a3fe2d, key1 = 0x37abe8f9;
while (len--) {
__u32 key = key1 + (key0 ^ (*name++ * 7152373));
......
......@@ -374,9 +374,11 @@ static void loop_make_request(struct request_queue *q, struct bio *old_bio)
static inline void loop_handle_bio(struct lloop_device *lo, struct bio *bio)
{
int ret;
ret = do_bio_lustrebacked(lo, bio);
while (bio) {
struct bio *tmp = bio->bi_next;
bio->bi_next = NULL;
bio->bi_error = ret;
bio_endio(bio);
......@@ -430,6 +432,7 @@ static int loop_thread(void *data)
wait_event(lo->lo_bh_wait, loop_active(lo));
if (!atomic_read(&lo->lo_pending)) {
int exiting = 0;
spin_lock_irq(&lo->lo_lock);
exiting = (lo->lo_state == LLOOP_RUNDOWN);
spin_unlock_irq(&lo->lo_lock);
......
......@@ -1017,6 +1017,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) {
__u32 type = llite_opcode_table[id].type;
void *ptr = NULL;
if (type & LPROCFS_TYPE_REGS)
ptr = "regs";
else if (type & LPROCFS_TYPE_BYTES)
......
......@@ -327,6 +327,7 @@ static unsigned long ll_ra_count_get(struct ll_sb_info *sbi,
* the RPC boundary from needing an extra read RPC. */
if (ria->ria_pages == 0) {
long beyond_rpc = (ria->ria_start + ret) % PTLRPC_MAX_BRW_PAGES;
if (/* beyond_rpc != 0 && */ beyond_rpc < ret)
ret -= beyond_rpc;
}
......@@ -343,6 +344,7 @@ static unsigned long ll_ra_count_get(struct ll_sb_info *sbi,
void ll_ra_count_put(struct ll_sb_info *sbi, unsigned long len)
{
struct ll_ra_info *ra = &sbi->ll_ra_info;
atomic_sub(len, &ra->ra_cur_pages);
}
......@@ -355,6 +357,7 @@ static void ll_ra_stats_inc_sbi(struct ll_sb_info *sbi, enum ra_stat which)
void ll_ra_stats_inc(struct address_space *mapping, enum ra_stat which)
{
struct ll_sb_info *sbi = ll_i2sbi(mapping->host);
ll_ra_stats_inc_sbi(sbi, which);
}
......
......@@ -418,6 +418,7 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter,
result = iov_iter_get_pages_alloc(iter, &pages, count, &offs);
if (likely(result > 0)) {
int n = DIV_ROUND_UP(result + offs, PAGE_SIZE);
result = ll_direct_IO_26_seg(env, io, iov_iter_rw(iter),
inode, file->f_mapping,
result, file_offset, pages,
......
......@@ -51,6 +51,7 @@ static struct kmem_cache *ll_inode_cachep;
static struct inode *ll_alloc_inode(struct super_block *sb)
{
struct ll_inode_info *lli;
ll_stats_ops_tally(ll_s2sbi(sb), LPROC_LL_ALLOC_INODE, 1);
OBD_SLAB_ALLOC_PTR_GFP(lli, ll_inode_cachep, GFP_NOFS);
if (lli == NULL)
......@@ -64,6 +65,7 @@ static void ll_inode_destroy_callback(struct rcu_head *head)
{
struct inode *inode = container_of(head, struct inode, i_rcu);
struct ll_inode_info *ptr = ll_i2info(inode);
OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep);
}
......
......@@ -1039,6 +1039,7 @@ static int vvp_io_commit_write(const struct lu_env *env,
need_clip = false;
} else if (last_index == pg->cp_index) {
int size_to = i_size_read(inode) & ~CFS_PAGE_MASK;
if (to < size_to)
to = size_to;
}
......
......@@ -560,6 +560,7 @@ int lmv_check_connect(struct obd_device *obd)
out_disc:
while (i-- > 0) {
int rc2;
tgt = lmv->tgts[i];
if (tgt == NULL)
continue;
......@@ -1084,6 +1085,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp,
}
case LL_IOC_HSM_CT_START: {
struct lustre_kernelcomm *lk = karg;
if (lk->lk_flags & LK_FLG_STOP)
rc = lmv_hsm_ct_unregister(lmv, cmd, len, lk, uarg);
else
......@@ -1335,6 +1337,7 @@ static int lmv_cleanup(struct obd_device *obd)
fld_client_fini(&lmv->lmv_fld);
if (lmv->tgts != NULL) {
int i;
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
if (lmv->tgts[i] == NULL)
continue;
......@@ -1813,6 +1816,7 @@ lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
if (body->valid & OBD_MD_MDS) {
struct lu_fid rid = body->fid1;
CDEBUG(D_INODE, "Request attrs for "DFID"\n",
PFID(&rid));
......@@ -2692,6 +2696,7 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp,
curspace = curinodes = 0;
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
int err;
tgt = lmv->tgts[i];
if (tgt == NULL || tgt->ltd_exp == NULL || tgt->ltd_active == 0)
......@@ -2727,6 +2732,7 @@ static int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp,
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
int err;
tgt = lmv->tgts[i];
if (tgt == NULL || tgt->ltd_exp == NULL || !tgt->ltd_active) {
CERROR("lmv idx %d inactive\n", i);
......
......@@ -149,6 +149,7 @@ static void *lmv_tgt_seq_start(struct seq_file *p, loff_t *pos)
{
struct obd_device *dev = p->private;
struct lmv_obd *lmv = &dev->u.lmv;
return (*pos >= lmv->desc.ld_tgt_count) ? NULL : lmv->tgts[*pos];
}
......
......@@ -330,6 +330,7 @@ static void lov_io_slice_init(struct lov_io *lio,
case CIT_FAULT: {
pgoff_t index = io->u.ci_fault.ft_index;
lio->lis_pos = cl_offset(io->ci_obj, index);
lio->lis_endpos = cl_offset(io->ci_obj, index + 1);
break;
......
......@@ -227,6 +227,7 @@ static int lov_sublock_lock(const struct lu_env *env,
result = CLO_REPEAT;
} else if (lsep) {
struct lov_sublock_env *subenv;
subenv = lov_sublock_env_get(env, parent, lls);
if (IS_ERR(subenv)) {
lov_sublock_unlock(env, sublock,
......@@ -981,6 +982,7 @@ static int lov_lock_fits_into(const struct lu_env *env,
result = cl_lock_ext_match(&lov->lls_orig, need);
else if (lov->lls_nr == 1) {
struct cl_lock_descr *got = &lov->lls_sub[0].sub_got;
result = lov_lock_stripe_is_matching(env,
cl2lov(slice->cls_obj),
lov->lls_sub[0].sub_stripe,
......@@ -1151,6 +1153,7 @@ static void lov_empty_lock_fini(const struct lu_env *env,
struct cl_lock_slice *slice)
{
struct lov_lock *lck = cl2lov_lock(slice);
OBD_SLAB_FREE_PTR(lck, lov_lock_kmem);
}
......
......@@ -85,6 +85,7 @@ static void lov_putref(struct obd_device *obd)
LIST_HEAD(kill);
int i;
struct lov_tgt_desc *tgt, *n;
CDEBUG(D_CONFIG, "destroying %d lov targets\n",
lov->lov_death_row);
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
......@@ -833,6 +834,7 @@ static int lov_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
switch (stage) {
case OBD_CLEANUP_EARLY: {
int i;
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_active)
continue;
......@@ -869,6 +871,7 @@ static int lov_cleanup(struct obd_device *obd)
lprocfs_obd_cleanup(obd);
if (lov->lov_tgts) {
int i;
obd_getref(obd);
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
if (!lov->lov_tgts[i])
......@@ -1256,6 +1259,7 @@ static int lov_setattr_async(struct obd_export *exp, struct obd_info *oinfo,
/* If we are not waiting for responses on async requests, return. */
if (rc || !rqset || list_empty(&rqset->set_requests)) {
int err;
if (rc)
atomic_set(&set->set_completes, 0);
err = lov_fini_setattr_set(set);
......@@ -1348,6 +1352,7 @@ static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo,
if (rc || list_empty(&rqset->set_requests)) {
int err;
if (rc)
atomic_set(&set->set_completes, 0);
err = lov_fini_statfs_set(set);
......
......@@ -282,6 +282,7 @@ static int pool_proc_open(struct inode *inode, struct file *file)
rc = seq_open(file, &pool_proc_ops);
if (!rc) {
struct seq_file *s = file->private_data;
s->private = inode->i_private;
}
return rc;
......
......@@ -955,6 +955,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp,
if (KEY_IS(KEY_INIT_RECOV_BACKUP)) {
struct obd_import *imp = class_exp2cliimp(exp);
int value;
if (vallen != sizeof(int))
return -EINVAL;
value = *(int *)val;
......@@ -1058,6 +1059,7 @@ static int mgc_import_event(struct obd_device *obd,
break;
case IMP_EVENT_INVALIDATE: {
struct ldlm_namespace *ns = obd->obd_namespace;
ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
break;
}
......@@ -1648,6 +1650,7 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf)
rc = mgc_process_log(obd, cld->cld_recover);
} else {
struct config_llog_data *cir = cld->cld_recover;
cld->cld_recover = NULL;
config_log_put(cir);
}
......
......@@ -715,6 +715,7 @@ static int cl_page_in_io(const struct cl_page *page, const struct cl_io *io)
*/
if (!cl_io_is_append(io)) {
const struct cl_io_rw_common *crw = &(io->u.ci_rw);
start = cl_offset(page->cp_obj, idx);
end = cl_offset(page->cp_obj, idx + 1);
result = crw->crw_pos < end &&
......@@ -1311,6 +1312,7 @@ static void cl_req_free(const struct lu_env *env, struct cl_req *req)
if (req->crq_o != NULL) {
for (i = 0; i < req->crq_nrobjs; ++i) {
struct cl_object *obj = req->crq_o[i].ro_obj;
if (obj != NULL) {
lu_object_ref_del_at(&obj->co_lu,
&req->crq_o[i].ro_obj_ref,
......
......@@ -129,6 +129,7 @@ static void cl_lock_trace0(int level, const struct lu_env *env,
const char *func, const int line)
{
struct cl_object_header *h = cl_object_header(lock->cll_descr.cld_obj);
CDEBUG(level, "%s: %p@(%d %p %d %d %d %d %d %lx)(%p/%d/%d) at %s():%d\n",
prefix, lock, atomic_read(&lock->cll_ref),
lock->cll_guarder, lock->cll_depth,
......@@ -1098,6 +1099,7 @@ int cl_use_try(const struct lu_env *env, struct cl_lock *lock, int atomic)
/* @atomic means back-off-on-failure. */
if (atomic) {
int rc;
rc = cl_unuse_try_internal(env, lock);
/* Vet the results. */
if (rc < 0 && result > 0)
......
......@@ -567,6 +567,7 @@ static unsigned cl_env_hops_hash(struct cfs_hash *lh,
static void *cl_env_hops_obj(struct hlist_node *hn)
{
struct cl_env *cle = hlist_entry(hn, struct cl_env, ce_node);
LASSERT(cle->ce_magic == &cl_env_init0);
return (void *)cle;
}
......@@ -582,6 +583,7 @@ static int cl_env_hops_keycmp(const void *key, struct hlist_node *hn)
static void cl_env_hops_noop(struct cfs_hash *hs, struct hlist_node *hn)
{
struct cl_env *cle = hlist_entry(hn, struct cl_env, ce_node);
LASSERT(cle->ce_magic == &cl_env_init0);
}
......
......@@ -477,6 +477,7 @@ extern int class_procfs_clean(void);
static int __init init_obdclass(void)
{
int i, err;
int lustre_register_fs(void);
LCONSOLE_INFO("Lustre: Build Version: "BUILD_VERSION"\n");
......@@ -548,6 +549,7 @@ static int __init init_obdclass(void)
static void cleanup_obdclass(void)
{
int i;
int lustre_unregister_fs(void);
lustre_unregister_fs();
......@@ -555,6 +557,7 @@ static void cleanup_obdclass(void)
misc_deregister(&obd_psdev);
for (i = 0; i < class_devno_max(); i++) {
struct obd_device *obd = class_num2obd(i);
if (obd && obd->obd_set_up &&
OBT(obd) && OBP(obd, detach)) {
/* XXX should this call generic detach otherwise? */
......
......@@ -672,6 +672,7 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
if (ret.lc_count != 0) {
/* first argument to do_div MUST be __u64 */
__u64 sum = ret.lc_sum;
do_div(sum, ret.lc_count);
ret.lc_sum = sum;
} else
......@@ -718,6 +719,7 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
if (ret.lc_sum > 0 && ret.lc_count > 0) {
/* first argument to do_div MUST be __u64 */
__u64 sum = ret.lc_sum;
do_div(sum, ret.lc_count);
ret.lc_sum = sum;
seq_printf(m,
......@@ -733,6 +735,7 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
if (ret.lc_sum > 0 && ret.lc_count != 0) {
/* first argument to do_div MUST be __u64 */
__u64 sum = ret.lc_sum;
do_div(sum, ret.lc_count);
ret.lc_sum = sum;
seq_printf(m,
......@@ -783,6 +786,7 @@ EXPORT_SYMBOL(lprocfs_rd_state);
int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at)
{
int i;
for (i = 0; i < AT_BINS; i++)
seq_printf(m, "%3u ", at->at_hist[i]);
seq_printf(m, "\n");
......@@ -1314,6 +1318,7 @@ int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count,
if (*end == '.') {
int i;
pbuf = end + 1;
/* need to limit frac_d to a __u32 */
......
......@@ -1054,6 +1054,7 @@ EXPORT_SYMBOL(lu_site_fini);
int lu_site_init_finish(struct lu_site *s)
{
int result;
mutex_lock(&lu_sites_guard);
result = lu_context_refill(&lu_shrink_env.le_ctx);
if (result == 0)
......
......@@ -126,6 +126,7 @@ static void class_handle_unhash_nolock(struct portals_handle *h)
void class_handle_unhash(struct portals_handle *h)
{
struct handle_bucket *bucket;
bucket = handle_hash + (h->h_cookie & HANDLE_HASH_MASK);
spin_lock(&bucket->lock);
......@@ -233,6 +234,7 @@ static int cleanup_all_handles(void)
void class_handle_cleanup(void)
{
int count;
LASSERT(handle_hash != NULL);
count = cleanup_all_handles();
......
......@@ -851,6 +851,7 @@ int class_process_config(struct lustre_cfg *lcfg)
}
case LCFG_MARKER: {
struct cfg_marker *marker;
marker = lustre_cfg_buf(lcfg, 1);
CDEBUG(D_IOCTL, "marker %d (%#x) %.16s %s\n", marker->cm_step,
marker->cm_flags, marker->cm_tgtname, marker->cm_comment);
......@@ -1015,6 +1016,7 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
rc = -EROFS;
if (var->fops && var->fops->write) {
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(KERNEL_DS);
rc = (var->fops->write)(&fakefile, sval,
......@@ -1091,6 +1093,7 @@ int class_config_llog_handler(const struct lu_env *env,
/* Figure out config state info */
if (lcfg->lcfg_command == LCFG_MARKER) {
struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
lustre_swab_cfg_marker(marker, swab,
LUSTRE_CFG_BUFLEN(lcfg, 1));
CDEBUG(D_CONFIG, "Marker, inst_flg=%#x mark_flg=%#x\n",
......
......@@ -177,6 +177,7 @@ static int lustre_start_simple(char *obdname, char *type, char *uuid,
char *s1, char *s2, char *s3, char *s4)
{
int rc;
CDEBUG(D_MOUNT, "Starting obd %s (typ=%s)\n", obdname, type);
rc = do_lcfg(obdname, 0, LCFG_ATTACH, type, uuid, NULL, NULL);
......@@ -979,6 +980,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
} else if (strncmp(s1, "param=", 6) == 0) {
int length;
char *tail = strchr(s1 + 6, ',');
if (tail == NULL)
length = strlen(s1);
else
......
......@@ -377,6 +377,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)
{
struct obd_device *obd = m->private;
int i;
DECLARE_CKSUM_NAME;
if (obd == NULL)
......@@ -400,6 +401,7 @@ static ssize_t osc_checksum_type_seq_write(struct file *file,
{
struct obd_device *obd = ((struct seq_file *)file->private_data)->private;
int i;
DECLARE_CKSUM_NAME;
char kernbuf[10];
......@@ -627,6 +629,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
for (i = 0; i < OBD_HIST_MAX; i++) {
unsigned long r = cli->cl_read_page_hist.oh_buckets[i];
unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
......@@ -650,6 +653,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
for (i = 0; i < OBD_HIST_MAX; i++) {
unsigned long r = cli->cl_read_rpc_hist.oh_buckets[i];
unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
......@@ -673,6 +677,7 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
for (i = 0; i < OBD_HIST_MAX; i++) {
unsigned long r = cli->cl_read_offset_hist.oh_buckets[i];
unsigned long w = cli->cl_write_offset_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
......
......@@ -247,6 +247,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext,
if (ext->oe_osclock) {
struct cl_lock_descr *descr;
descr = &ext->oe_osclock->cll_descr;
if (!(descr->cld_start <= ext->oe_start &&
descr->cld_end >= ext->oe_max_end)) {
......@@ -475,6 +476,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext)
static void osc_extent_erase(struct osc_extent *ext)
{
struct osc_object *obj = ext->oe_obj;
LASSERT(osc_object_is_locked(obj));
if (ext->oe_intree) {
rb_erase(&ext->oe_node, &obj->oo_root);
......@@ -868,6 +870,7 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext,
int offset = oap->oap_page_off & ~CFS_PAGE_MASK;
int count = oap->oap_count + (offset & (blocksize - 1));
int end = (offset + oap->oap_count) & (blocksize - 1);
if (end)
count += blocksize - end;
......@@ -1510,6 +1513,7 @@ static int osc_enter_cache_try(struct client_obd *cli,
static int ocw_granted(struct client_obd *cli, struct osc_cache_waiter *ocw)
{
int rc;
client_obd_list_lock(&cli->cl_loi_list_lock);
rc = list_empty(&ocw->ocw_entry);
client_obd_list_unlock(&cli->cl_loi_list_lock);
......@@ -1632,6 +1636,7 @@ void osc_wake_cache_waiters(struct client_obd *cli)
static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc)
{
int hprpc = !!list_empty(&osc->oo_hp_exts);
return rpcs_in_flight(cli) >= cli->cl_max_rpcs_in_flight + hprpc;
}
......@@ -1693,6 +1698,7 @@ static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc,
static void osc_update_pending(struct osc_object *obj, int cmd, int delta)
{
struct client_obd *cli = osc_cli(obj);
if (cmd & OBD_BRW_WRITE) {
atomic_add(delta, &obj->oo_nr_writes);
atomic_add(delta, &cli->cl_pending_w_pages);
......@@ -2566,6 +2572,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj,
list_for_each_entry(oap, list, oap_pending_item) {
struct cl_page *cp = oap2cl_page(oap);
if (cp->cp_index > end)
end = cp->cp_index;
if (cp->cp_index < start)
......@@ -2851,6 +2858,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj,
result += ext->oe_nr_pages;
if (!discard) {
struct list_head *list = NULL;
if (hp) {
EASSERT(!ext->oe_hp, ext);
ext->oe_hp = 1;
......@@ -2924,6 +2932,7 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj,
if (hp || discard) {
int rc;
rc = osc_cache_wait_range(env, obj, start, end);
if (result >= 0 && rc < 0)
result = rc;
......
......@@ -166,6 +166,7 @@ static void osc_page_fini(const struct lu_env *env,
struct cl_page_slice *slice)
{
struct osc_page *opg = cl2osc_page(slice);
CDEBUG(D_TRACE, "%p\n", opg);
LASSERT(opg->ops_lock == NULL);
}
......@@ -512,6 +513,7 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj,
cl_offset(obj, page->cp_index));
if (result == 0) {
struct osc_io *oio = osc_env_io(env);
opg->ops_srvlock = osc_io_srvlock(oio);
cl_page_slice_add(page, &opg->ops_cl, obj,
&osc_page_ops);
......@@ -624,6 +626,7 @@ static int discard_pagevec(const struct lu_env *env, struct cl_io *io,
for (count = 0, i = 0; i < max_index; i++) {
struct cl_page *page = pvec[i];
if (cl_page_own_try(env, io, page) == 0) {
/* free LRU page only if nobody is using it.
* This check is necessary to avoid freeing the pages
......
......@@ -158,6 +158,7 @@ static void *
oqi_key(struct hlist_node *hnode)
{
struct osc_quota_info *oqi;
oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
return &oqi->oqi_id;
}
......
......@@ -1179,6 +1179,7 @@ static u32 osc_checksum_bulk(int nob, u32 pg_count,
OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE)) {
unsigned char *ptr = kmap(pga[i]->pg);
int off = pga[i]->off & ~CFS_PAGE_MASK;
memcpy(ptr + off, "bad1", min(4, nob));
kunmap(pga[i]->pg);
}
......@@ -1886,6 +1887,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
i = 0;
list_for_each_entry(oap, &rpc_list, oap_rpc_item) {
struct cl_page *page = oap2cl_page(oap);
if (clerq == NULL) {
clerq = cl_req_alloc(env, page, crt,
1 /* only 1-object rpcs for now */);
......@@ -2091,6 +2093,7 @@ static int osc_enqueue_fini(struct ptlrpc_request *req, struct ost_lvb *lvb,
/* The request was created before ldlm_cli_enqueue call. */
if (rc == ELDLM_LOCK_ABORTED) {
struct ldlm_reply *rep;
rep = req_capsule_server_get(&req->rq_pill,
&RMF_DLM_REP);
......@@ -2277,6 +2280,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
no_match:
if (intent) {
LIST_HEAD(cancels);
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_ENQUEUE_LVB);
if (req == NULL)
......@@ -2301,6 +2305,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id,
if (rqset) {
if (!rc) {
struct osc_enqueue_args *aa;
CLASSERT (sizeof(*aa) <= sizeof(req->rq_async_args));
aa = ptlrpc_req_async_args(req);
aa->oa_ei = einfo;
......@@ -3170,6 +3175,7 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
switch (stage) {
case OBD_CLEANUP_EARLY: {
struct obd_import *imp;
imp = obd->u.cli.cl_import;
CDEBUG(D_HA, "Deactivating import %s\n", obd->obd_name);
/* ptlrpc_abort_inflight to stop an mds_lov_synchronize */
......
......@@ -660,6 +660,7 @@ int ptlrpc_request_pack(struct ptlrpc_request *request,
__u32 version, int opcode)
{
int rc;
rc = ptlrpc_request_bufs_pack(request, version, opcode, NULL, NULL);
if (rc)
return rc;
......@@ -1089,6 +1090,7 @@ static int ptlrpc_check_status(struct ptlrpc_request *req)
if (lustre_msg_get_type(req->rq_repmsg) == PTL_RPC_MSG_ERR) {
struct obd_import *imp = req->rq_import;
__u32 opc = lustre_msg_get_opc(req->rq_reqmsg);
if (ptlrpc_console_allow(req))
LCONSOLE_ERROR_MSG(0x011, "%s: Communicating with %s, operation %s failed with %d.\n",
imp->imp_obd->obd_name,
......
......@@ -454,6 +454,7 @@ int ptlrpc_reconnect_import(struct obd_import *imp)
if (atomic_read(&imp->imp_inval_count) > 0) {
int rc;
struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL);
rc = l_wait_event(imp->imp_recovery_waitq,
(atomic_read(&imp->imp_inval_count) == 0),
&lwi);
......@@ -535,6 +536,7 @@ static int import_select_connection(struct obd_import *imp)
trying to reconnect on it.) */
if (tried_all && (imp->imp_conn_list.next == &imp_conn->oic_item)) {
struct adaptive_timeout *at = &imp->imp_at.iat_net_latency;
if (at_get(at) < CONNECTION_SWITCH_MAX) {
at_measured(at, at_get(at) + CONNECTION_SWITCH_INC);
if (at_get(at) > CONNECTION_SWITCH_MAX)
......
......@@ -118,6 +118,7 @@ static int llog_client_open(const struct lu_env *env,
if (name) {
char *tmp;
tmp = req_capsule_client_sized_get(&req->rq_pill, &RMF_NAME,
strlen(name) + 1);
LASSERT(tmp);
......
......@@ -166,6 +166,7 @@ const char *ll_opcode2str(__u32 opcode)
* ptlrpc_internal.h needs to be modified.
*/
__u32 offset = opcode_offset(opcode);
LASSERTF(offset < LUSTRE_MAX_OPCODES,
"offset %u >= LUSTRE_MAX_OPCODES %u\n",
offset, LUSTRE_MAX_OPCODES);
......@@ -239,6 +240,7 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
}
for (i = 0; i < LUSTRE_MAX_OPCODES; i++) {
__u32 opcode = ll_rpc_opcode_table[i].opcode;
lprocfs_counter_init(svc_stats,
EXTRA_MAX_OPCODES + i, svc_counter_config,
ll_opcode2str(opcode), "usec");
......
......@@ -98,6 +98,7 @@ EXPORT_SYMBOL(ptlrpc_buf_need_swab);
int lustre_msg_early_size(void)
{
static int size;
if (!size) {
/* Always reply old ptlrpc_body_v2 to keep interoperability
* with the old client (< 2.3) which doesn't have pb_jobid
......@@ -107,6 +108,7 @@ int lustre_msg_early_size(void)
* client.
*/
__u32 pblen = sizeof(struct ptlrpc_body_v2);
size = lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, &pblen);
}
return size;
......@@ -187,6 +189,7 @@ void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
ptr = (char *)msg + lustre_msg_hdr_size_v2(count);
for (i = 0; i < count; i++) {
char *tmp = bufs[i];
LOGL(tmp, lens[i], ptr);
}
}
......@@ -572,6 +575,7 @@ EXPORT_SYMBOL(__lustre_unpack_msg);
int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len)
{
int rc;
rc = __lustre_unpack_msg(req->rq_reqmsg, len);
if (rc == 1) {
lustre_set_req_swabbed(req, MSG_PTLRPC_HEADER_OFF);
......@@ -584,6 +588,7 @@ EXPORT_SYMBOL(ptlrpc_unpack_req_msg);
int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len)
{
int rc;
rc = __lustre_unpack_msg(req->rq_repmsg, len);
if (rc == 1) {
lustre_set_rep_swabbed(req, MSG_PTLRPC_HEADER_OFF);
......@@ -785,6 +790,7 @@ __u32 lustre_msg_get_flags(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (pb)
return pb->pb_flags;
......@@ -804,6 +810,7 @@ void lustre_msg_add_flags(struct lustre_msg *msg, int flags)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_flags |= flags;
return;
......@@ -819,6 +826,7 @@ void lustre_msg_set_flags(struct lustre_msg *msg, int flags)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_flags = flags;
return;
......@@ -834,6 +842,7 @@ void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_flags &= ~(flags & MSG_GEN_FLAG_MASK);
return;
......@@ -849,6 +858,7 @@ __u32 lustre_msg_get_op_flags(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (pb)
return pb->pb_op_flags;
......@@ -866,6 +876,7 @@ void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_op_flags |= flags;
return;
......@@ -881,6 +892,7 @@ struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return NULL;
......@@ -899,6 +911,7 @@ __u32 lustre_msg_get_type(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return PTL_RPC_MSG_ERR;
......@@ -917,6 +930,7 @@ void lustre_msg_add_version(struct lustre_msg *msg, int version)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_version |= version;
return;
......@@ -932,6 +946,7 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
......@@ -951,6 +966,7 @@ __u64 lustre_msg_get_last_committed(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
......@@ -969,6 +985,7 @@ __u64 *lustre_msg_get_versions(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return NULL;
......@@ -987,6 +1004,7 @@ __u64 lustre_msg_get_transno(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
......@@ -1005,6 +1023,7 @@ int lustre_msg_get_status(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (pb)
return pb->pb_status;
......@@ -1024,6 +1043,7 @@ __u64 lustre_msg_get_slv(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return -EINVAL;
......@@ -1043,6 +1063,7 @@ void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return;
......@@ -1062,6 +1083,7 @@ __u32 lustre_msg_get_limit(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return -EINVAL;
......@@ -1081,6 +1103,7 @@ void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return;
......@@ -1100,6 +1123,7 @@ __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
......@@ -1130,6 +1154,7 @@ __u32 lustre_msg_get_timeout(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
......@@ -1148,6 +1173,7 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
......@@ -1179,6 +1205,7 @@ __u32 lustre_msg_calc_cksum(struct lustre_msg *msg)
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
__u32 crc;
unsigned int hsize = 4;
cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, (unsigned char *)pb,
lustre_msg_buflen(msg, MSG_PTLRPC_BODY_OFF),
NULL, 0, (unsigned char *)&crc, &hsize);
......@@ -1195,6 +1222,7 @@ void lustre_msg_set_handle(struct lustre_msg *msg, struct lustre_handle *handle)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_handle = *handle;
return;
......@@ -1210,6 +1238,7 @@ void lustre_msg_set_type(struct lustre_msg *msg, __u32 type)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_type = type;
return;
......@@ -1225,6 +1254,7 @@ void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_opc = opc;
return;
......@@ -1240,6 +1270,7 @@ void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_pre_versions[0] = versions[0];
pb->pb_pre_versions[1] = versions[1];
......@@ -1258,6 +1289,7 @@ void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_transno = transno;
return;
......@@ -1273,6 +1305,7 @@ void lustre_msg_set_status(struct lustre_msg *msg, __u32 status)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_status = status;
return;
......@@ -1288,6 +1321,7 @@ void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_conn_cnt = conn_cnt;
return;
......@@ -1303,6 +1337,7 @@ void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_timeout = timeout;
return;
......@@ -1317,6 +1352,7 @@ void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time)
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_service_time = service_time;
return;
......@@ -1684,6 +1720,7 @@ EXPORT_SYMBOL(lustre_swab_mdt_ioepoch);
void lustre_swab_mgs_target_info(struct mgs_target_info *mti)
{
int i;
__swab32s(&mti->mti_lustre_ver);
__swab32s(&mti->mti_stripe_index);
__swab32s(&mti->mti_config_ver);
......
......@@ -103,6 +103,7 @@ static int ptlrpc_ping(struct obd_import *imp)
static void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
{
int time = soon ? PING_INTERVAL_SHORT : PING_INTERVAL;
if (imp->imp_state == LUSTRE_IMP_DISCON) {
int dtime = max_t(int, CONNECTION_SWITCH_MIN,
AT_OFF ? 0 :
......@@ -135,6 +136,7 @@ static long pinger_check_timeout(unsigned long time)
mutex_lock(&pinger_mutex);
list_for_each_entry(item, &timeout_list, ti_chain) {
int ti_timeout = item->ti_timeout;
if (timeout > ti_timeout)
timeout = ti_timeout;
break;
......
......@@ -1982,6 +1982,7 @@ int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen)
rc = policy->sp_sops->alloc_rs(req, msglen);
if (unlikely(rc == -ENOMEM)) {
struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt;
if (svcpt->scp_service->srv_max_reply_size <
msglen + sizeof(struct ptlrpc_reply_state)) {
/* Just return failure if the size is too big */
......
......@@ -84,6 +84,7 @@ int null_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
if (!req->rq_import->imp_dlm_fake) {
struct obd_device *obd = req->rq_import->imp_obd;
null_encode_sec_part(req->rq_reqbuf,
obd->u.cli.cl_sp_me);
}
......
......@@ -1352,6 +1352,7 @@ static bool ptlrpc_server_allow_normal(struct ptlrpc_service_part *svcpt,
bool force)
{
int running = svcpt->scp_nthrs_running;
if (unlikely(svcpt->scp_service->srv_req_portal == MDS_REQUEST_PORTAL &&
CFS_FAIL_PRECHECK(OBD_FAIL_PTLRPC_CANCEL_RESEND))) {
/* leave just 1 thread for normal RPCs */
......@@ -1722,6 +1723,7 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt,
if (likely(svc->srv_stats != NULL && request->rq_reqmsg != NULL)) {
__u32 op = lustre_msg_get_opc(request->rq_reqmsg);
int opc = opcode_offset(op);
if (opc > 0 && !(op == LDLM_ENQUEUE || op == MDS_REINT)) {
LASSERT(opc < LUSTRE_MAX_OPCODES);
lprocfs_counter_add(svc->srv_stats,
......@@ -2256,6 +2258,7 @@ static int ptlrpc_start_hr_threads(void)
for (j = 0; j < hrp->hrp_nthrs; j++) {
struct ptlrpc_hr_thread *hrt = &hrp->hrp_thrs[j];
rc = PTR_ERR(kthread_run(ptlrpc_hr_main,
&hrp->hrp_thrs[j],
"ptlrpc_hr%02d_%03d",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment