#define LASSERTF(cond, fmt...) do { } while (0)
#endif
+#ifdef CONFIG_SMP
+#define LASSERT_SPIN_LOCKED(lock) LASSERT(spin_is_locked(lock))
+#else
+#define LASSERT_SPIN_LOCKED(lock) do {} while(0)
+#endif
+
#ifdef __arch_um__
#define LBUG_WITH_LOC(file, func, line) \
do { \
static const char *portal_debug_subsystems[] =
{"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
"rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter",
- "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL};
+ "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", "ibnal",
+ NULL};
static const char *portal_debug_masks[] =
{"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
"blocks", "net", "warning", "buffs", "other", "dentry", "portals",
- don't delete objects on OST if given a bogus objid from MDS (2751)
- handle large client PAGE_SIZE readdir on small PAGE_SIZE MDS (2777)
- if rq_no_resend, then timeout request after recovery (2432)
+ - fix MDS llog_logid record size, 64-bit array alignment (2733)
+ - don't call usermode_helper from ptlrpcd, DEFAULT upcall (2773)
+ - put magic in mount.lustre data, check for bad/NULL mount data (2529)
* miscellania
- return LL_SUPER_MAGIC from statfs for the filesystem type (1972)
/* Passed by mount */
struct lustre_mount_data {
+ uint32_t lmd_magic;
uint32_t lmd_version;
uint64_t lmd_local_nid;
uint64_t lmd_server_nid;
struct osc_creator {
spinlock_t oscc_lock;
struct list_head oscc_list;
- struct obd_export *oscc_exp;
+ struct obd_device *oscc_obd;
obd_id oscc_last_id;//last available pre-created object
obd_id oscc_next_id;// what object id to give out next
int oscc_initial_create_count;
wait_queue_head_t oscc_waitq; /* creating procs wait on this */
};
-struct osc_export_data {
- struct osc_creator oed_oscc;
-};
-
struct ldlm_export_data {
struct list_head led_held_locks; /* protected by namespace lock */
};
struct mds_export_data eu_mds_data;
struct filter_export_data eu_filter_data;
struct ec_export_data eu_ec_data;
- struct osc_export_data eu_osc_data;
} u;
};
#define exp_mds_data u.eu_mds_data
#define exp_lov_data u.eu_lov_data
#define exp_filter_data u.eu_filter_data
-#define exp_osc_data u.eu_osc_data
#define exp_ec_data u.eu_ec_data
extern struct obd_export *class_conn2export(struct lustre_handle *conn);
void ptlrpc_wake_delayed(struct obd_import *imp);
int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid);
int ptlrpc_set_import_active(struct obd_import *imp, int active);
+void ptlrpc_invalidate_import(struct obd_import *imp);
void ptlrpc_fail_import(struct obd_import *imp, int generation);
void ptlrpc_fail_export(struct obd_export *exp);
__u32 lgl_ogen;
} __attribute__((packed));
+/* Records written to the CATALOGS list */
+#define CATLIST "CATALOGS"
+struct llog_catid {
+ struct llog_logid lci_logid;
+ __u32 lci_padding[3];
+} __attribute__((packed));
+
/* Log data record types - there is no specific reason that these need to
* be related to the RPC opcodes, but no reason not to (may be handy later?)
*/
PTL_CFG_REC = 0x10630000,
LLOG_GEN_REC = 0x10640000,
LLOG_HDR_MAGIC = 0x10645539,
- LLOG_LOGID_MAGIC = 0x1064553a,
+ LLOG_LOGID_MAGIC = 0x1064553b,
} llog_op_type;
/* Log record header - stored in little endian order.
struct llog_logid_rec {
struct llog_rec_hdr lid_hdr;
struct llog_logid lid_id;
- __u32 padding;
+ __u32 padding[5];
struct llog_rec_tail lid_tail;
} __attribute__((packed));
return import_state_names[state];
}
+enum obd_import_event {
+ IMP_EVENT_DISCON = 0x808001,
+ IMP_EVENT_INVALIDATE = 0x808002,
+ IMP_EVENT_ACTIVE = 0x808003,
+};
struct obd_import {
struct portals_handle imp_handle;
/* flags */
int imp_invalid:1, imp_replayable:1,
imp_dlm_fake:1, imp_server_timeout:1,
- imp_initial_recov:1;
+ imp_initial_recov:1, imp_force_verify:1,
+ imp_pingable:1;
__u32 imp_connect_op;
};
})
#endif /* _LUSTRE_LIB_H */
+
+#define LMD_MAGIC 0xbdacbdac
+
+#define lmd_bad_magic(LMDP) \
+({ \
+ struct lustre_mount_data *_lmd__ = (LMDP); \
+ int _ret__ = 0; \
+ if (!_lmd__) { \
+ CERROR("Missing mount data: " \
+ "check that /sbin/mount.lustre is installed.\n");\
+ _ret__ = 1; \
+ } else if (_lmd__->lmd_magic != LMD_MAGIC) { \
+ CERROR("Invalid mount data (%#x != %#x): " \
+ "check that /sbin/mount.lustre is installed\n", \
+ _lmd__->lmd_magic, LMD_MAGIC); \
+ _ret__ = 1; \
+ } \
+ _ret__; \
+})
+
int llog_cat_initialize(struct obd_device *obd, int count);
int obd_llog_init(struct obd_device *obd, struct obd_device *disk_obd,
- int count, struct llog_logid *logid);
+ int count, struct llog_catid *logid);
int obd_llog_finish(struct obd_device *obd, int count);
};
/* llog_lvfs.c */
-int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
- char *name, int count, struct llog_logid *idarray);
extern struct llog_operations llog_lvfs_ops;
-
+int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
+ char *name, int count, struct llog_catid *idarray);
struct llog_ctxt {
int loc_idx; /* my index the obd array of ctxt's */
{
if (ctxt == NULL)
return -ENOTCONN;
-
+
*lop = ctxt->loc_logops;
if (*lop == NULL)
return -EOPNOTSUPP;
spinlock_t rq_lock;
/* client-side flags */
unsigned int rq_intr:1, rq_replied:1, rq_err:1,
- rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1,
- rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1;
+ rq_timedout:1, rq_resend:1, rq_restart:1, rq_replay:1,
+ rq_no_resend:1, rq_waiting:1, rq_receiving_reply:1,
+ rq_no_delay:1;
int rq_phase;
/* client-side refcount for SENT race */
atomic_t rq_refcount;
struct list_head fo_export_list;
int fo_subdir_count;
+
obd_size fo_tot_dirty; /* protected by obd_osfs_lock */
obd_size fo_tot_granted; /* all values in bytes */
obd_size fo_tot_pending;
struct mdc_rpc_lock *cl_rpc_lock;
struct mdc_rpc_lock *cl_setattr_lock;
+ struct osc_creator cl_oscc;
};
/* Like a client, with some hangers-on. Keep mc_client_obd first so that we
/* llog related obd_methods */
int (*o_llog_init)(struct obd_device *obd, struct obd_device *disk_obd,
- int count, struct llog_logid *logid);
+ int count, struct llog_catid *logid);
int (*o_llog_finish)(struct obd_device *obd, int count);
/* metadata-only methods */
struct obd_client_handle *, int flag);
int (*o_unpin)(struct obd_export *, struct obd_client_handle *, int);
- int (*o_invalidate_import)(struct obd_device *, struct obd_import *);
+ int (*o_import_event)(struct obd_device *, struct obd_import *,
+ enum obd_import_event);
int (*o_notify)(struct obd_device *obd, struct obd_device *watched,
int active);
return(rc);
}
-static inline void obd_invalidate_import(struct obd_device *obd,
- struct obd_import *imp)
+
+static inline void obd_import_event(struct obd_device *obd,
+ struct obd_import *imp,
+ enum obd_import_event event)
{
- if (obd->obd_set_up && OBP(obd, invalidate_import)) {
- OBD_COUNTER_INCREMENT(obd, invalidate_import);
- OBP(obd, invalidate_import)(obd, imp);
+ if (obd->obd_set_up && OBP(obd, import_event)) {
+ OBD_COUNTER_INCREMENT(obd, import_event);
+ OBP(obd, import_event)(obd, imp, event);
}
}
/* Yeah, obd_no_recov also (mainly) means "forced shutdown". */
if (obd->obd_no_recov)
- ptlrpc_set_import_active(imp, 0);
+ ptlrpc_invalidate_import(imp);
else
rc = ptlrpc_disconnect_import(imp);
EXIT;
out:
- if (lock->l_resource->lr_lvb_len > 0) {
- void *lvb = lustre_msg_buf(req->rq_repmsg, 1,
- lock->l_resource->lr_lvb_len);
- memcpy(lvb, lock->l_resource->lr_lvb_data,
- lock->l_resource->lr_lvb_len);
- }
req->rq_status = err;
/* The LOCK_CHANGED code in ldlm_lock_enqueue depends on this
if (lock) {
LDLM_DEBUG(lock, "server-side enqueue handler, sending reply"
"(err=%d)", err);
+
+ if (lock->l_resource->lr_lvb_len > 0) {
+ void *lvb = lustre_msg_buf(req->rq_repmsg, 1,
+ lock->l_resource->lr_lvb_len);
+ memcpy(lvb, lock->l_resource->lr_lvb_data,
+ lock->l_resource->lr_lvb_len);
+ }
+
if (!err && dlm_req->lock_desc.l_resource.lr_type != LDLM_FLOCK)
ldlm_reprocess_all(lock->l_resource);
LDLM_LOCK_PUT(lock);
(res, NULL, 0);
//(res, req->rq_reqmsg, 1);
}
-
+
ldlm_lock_cancel(lock);
if (ldlm_del_waiting_lock(lock))
CDEBUG(D_DLMTRACE, "cancelled waiting lock %p\n", lock);
static int ldlm_callback_reply(struct ptlrpc_request *req, int rc)
{
req->rq_status = rc;
- rc = lustre_pack_reply(req, 0, NULL, NULL);
- if (rc)
- return rc;
+ if (req->rq_reply_state == NULL) {
+ rc = lustre_pack_reply(req, 0, NULL, NULL);
+ if (rc)
+ return rc;
+ }
return ptlrpc_reply(req);
}
RETURN(0);
}
- if (req->rq_reqmsg->opc == LDLM_BL_CALLBACK) {
+ LASSERT(req->rq_export != NULL);
+ LASSERT(req->rq_export->exp_obd != NULL);
+
+ switch(req->rq_reqmsg->opc) {
+ case LDLM_BL_CALLBACK:
OBD_FAIL_RETURN(OBD_FAIL_LDLM_BL_CALLBACK, 0);
- } else if (req->rq_reqmsg->opc == LDLM_CP_CALLBACK) {
+ break;
+ case LDLM_CP_CALLBACK:
OBD_FAIL_RETURN(OBD_FAIL_LDLM_CP_CALLBACK, 0);
- } else if (req->rq_reqmsg->opc == LDLM_GL_CALLBACK) {
+ break;
+ case LDLM_GL_CALLBACK:
OBD_FAIL_RETURN(OBD_FAIL_LDLM_GL_CALLBACK, 0);
- } else if (req->rq_reqmsg->opc == OBD_LOG_CANCEL) {
+ break;
+ case OBD_LOG_CANCEL:
OBD_FAIL_RETURN(OBD_FAIL_OBD_LOG_CANCEL_NET, 0);
- } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CREATE) {
- OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
- } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_NEXT_BLOCK) {
- OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
- } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_READ_HEADER) {
- OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
- } else if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CLOSE) {
- OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
- } else {
- ldlm_callback_reply(req, -EPROTO);
- RETURN(0);
- }
-
- LASSERT(req->rq_export != NULL);
- LASSERT(req->rq_export->exp_obd != NULL);
-
- /* FIXME - how to send reply */
- if (req->rq_reqmsg->opc == OBD_LOG_CANCEL) {
- int rc = llog_origin_handle_cancel(req);
+ rc = llog_origin_handle_cancel(req);
ldlm_callback_reply(req, rc);
RETURN(0);
- }
- if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CREATE) {
- int rc = llog_origin_handle_create(req);
- req->rq_status = rc;
- ptlrpc_reply(req);
+ case LLOG_ORIGIN_HANDLE_CREATE:
+ OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
+ rc = llog_origin_handle_create(req);
+ ldlm_callback_reply(req, rc);
RETURN(0);
- }
- if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_NEXT_BLOCK) {
- int rc = llog_origin_handle_next_block(req);
- req->rq_status = rc;
- ptlrpc_reply(req);
+ case LLOG_ORIGIN_HANDLE_NEXT_BLOCK:
+ OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
+ rc = llog_origin_handle_next_block(req);
+ ldlm_callback_reply(req, rc);
RETURN(0);
- }
- if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_READ_HEADER) {
- int rc = llog_origin_handle_read_header(req);
- req->rq_status = rc;
- ptlrpc_reply(req);
+ case LLOG_ORIGIN_HANDLE_READ_HEADER:
+ OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
+ rc = llog_origin_handle_read_header(req);
+ ldlm_callback_reply(req, rc);
RETURN(0);
- }
- if (req->rq_reqmsg->opc == LLOG_ORIGIN_HANDLE_CLOSE) {
- int rc = llog_origin_handle_close(req);
+ case LLOG_ORIGIN_HANDLE_CLOSE:
+ OBD_FAIL_RETURN(OBD_FAIL_OBD_LOGD_NET, 0);
+ rc = llog_origin_handle_close(req);
ldlm_callback_reply(req, rc);
RETURN(0);
+ default:
+ CERROR("unknown opcode %u\n", req->rq_reqmsg->opc);
+ ldlm_callback_reply(req, -EPROTO);
+ RETURN(0);
}
ns = req->rq_export->exp_obd->obd_namespace;
* cancelling right now, because it's unused, or have an intent result
* in the reply, so we might have to push the responsibility for sending
* the reply down into the AST handlers, alas. */
- if (req->rq_reqmsg->opc == LDLM_CP_CALLBACK)
- ldlm_callback_reply(req, 0);
switch (req->rq_reqmsg->opc) {
case LDLM_BL_CALLBACK:
break;
case LDLM_CP_CALLBACK:
CDEBUG(D_INODE, "completion ast\n");
+ ldlm_callback_reply(req, 0);
ldlm_handle_cp_callback(req, ns, dlm_req, lock);
break;
case LDLM_GL_CALLBACK:
struct ptlrpc_request *req;
struct ldlm_request *body;
struct ldlm_reply *reply;
- int size;
+ int buffers = 1;
+ int size[2];
int flags;
/*
else
flags = LDLM_FL_REPLAY;
- size = sizeof(*body);
- req = ptlrpc_prep_req(imp, LDLM_ENQUEUE, 1, &size, NULL);
+ size[0] = sizeof(*body);
+ req = ptlrpc_prep_req(imp, LDLM_ENQUEUE, 1, size, NULL);
if (!req)
RETURN(-ENOMEM);
body->lock_flags = flags;
ldlm_lock2handle(lock, &body->lock_handle1);
- size = sizeof(*reply);
- req->rq_replen = lustre_msg_size(1, &size);
+ size[0] = sizeof(*reply);
+ if (lock->l_lvb_len != 0) {
+ buffers = 2;
+ size[1] = lock->l_lvb_len;
+ }
+ req->rq_replen = lustre_msg_size(buffers, size);
LDLM_DEBUG(lock, "replaying lock:");
LBUG();
}
- LDLM_DEBUG(lock, "i_size: %Lu -> stripe number %d -> size %Lu",
+ LDLM_DEBUG(lock, "i_size: %llu -> stripe number %u -> size "LPU64,
inode->i_size, data.stripe_number, data.size);
rc = lustre_pack_reply(req, 1, &size, NULL);
inode->i_size = kms;
}
- CDEBUG(D_INFO, "Reading inode %lu, "LPSZ" bytes, offset %Ld, i_size "
- LPU64"\n", inode->i_ino, count, *ppos, inode->i_size);
+ CDEBUG(D_INFO, "Read ino %lu, "LPSZ" bytes, offset %lld, i_size %llu\n",
+ inode->i_ino, count, *ppos, inode->i_size);
/* turn off the kernel's read-ahead */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
int err;
ENTRY;
+ if (lmd_bad_magic(lmd))
+ RETURN(-EINVAL);
+
generate_random_uuid(uuid);
class_uuid_unparse(uuid, &mdc_uuid);
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb);
- if (lmd == NULL) {
- CERROR("lustre_mount_data is NULL: check that /sbin/mount.lustre exists?\n");
+ if (lmd_bad_magic(lmd))
RETURN(-EINVAL);
- }
+
sbi = lustre_init_sbi(sb);
if (!sbi)
RETURN(-ENOMEM);
/* lov_log.c */
int lov_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid);
+ int count, struct llog_catid *logid);
int lov_llog_finish(struct obd_device *obd, int count);
/* lov_pack.c */
struct lov_mds_md *lmm, int lmm_bytes);
int lov_setstripe(struct obd_export *exp,
struct lov_stripe_md **lsmp, struct lov_user_md *lump);
-int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
+int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
struct lov_user_md *lump);
int lov_getstripe(struct obd_export *exp,
struct lov_stripe_md *lsm, struct lov_user_md *lump);
int lov_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *logid)
{
struct lov_obd *lov = &obd->u.lov;
int i, rc = 0;
ENTRY;
-
+
rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, 0, NULL,
&lov_unlink_orig_logops);
if (rc)
RETURN(rc);
- rc = llog_setup(obd, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL,
+ rc = llog_setup(obd, LLOG_SIZE_REPL_CTXT, tgt, 0, NULL,
&lov_size_repl_logops);
if (rc)
RETURN(rc);
#include <linux/lvfs.h>
-struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *ctxt, __u64 id, __u32 gen, __u64 gr,
- void *data)
+struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *ctxt, __u64 id,
+ __u32 gen, __u64 gr, void *data)
{
return ctxt->cb_ops.l_fid2dentry(id, gen, gr, data);
}
return lprocfs_obd_detach(dev);
}
+static int mdc_import_event(struct obd_device *obd,
+ struct obd_import *imp,
+ enum obd_import_event event)
+{
+ int rc = 0;
+
+ LASSERT(imp->imp_obd == obd);
+
+ switch (event) {
+ case IMP_EVENT_DISCON: {
+ break;
+ }
+ case IMP_EVENT_INVALIDATE: {
+ struct ldlm_namespace *ns = obd->obd_namespace;
+
+ ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
+
+ if (obd->obd_observer)
+ rc = obd_notify(obd->obd_observer, obd, 0);
+ break;
+ }
+ case IMP_EVENT_ACTIVE: {
+ if (obd->obd_observer)
+ rc = obd_notify(obd->obd_observer, obd, 1);
+ break;
+ }
+ default:
+ CERROR("Unknown import event %d\n", event);
+ LBUG();
+ }
+ RETURN(rc);
+}
+
static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
{
struct client_obd *cli = &obd->u.cli;
static int mdc_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *logid)
{
struct llog_ctxt *ctxt;
int rc;
&llog_client_ops);
if (rc == 0) {
ctxt = llog_get_context(obd, LLOG_CONFIG_REPL_CTXT);
- ctxt->loc_imp = obd->u.cli.cl_import;
+ ctxt->loc_imp = obd->u.cli.cl_import;
}
RETURN(rc);
o_statfs: mdc_statfs,
o_pin: mdc_pin,
o_unpin: mdc_unpin,
+ o_import_event: mdc_import_event,
o_llog_init: mdc_llog_init,
o_llog_finish: mdc_llog_finish,
};
RETURN(rc);
}
-static int mds_disconnect(struct obd_export *export, int flags)
+static int mds_disconnect(struct obd_export *exp, int flags)
{
unsigned long irqflags;
int rc;
ENTRY;
- ldlm_cancel_locks_for_export(export);
+ LASSERT(exp);
+ class_export_get(exp);
+
+ spin_lock_irqsave(&exp->exp_lock, irqflags);
+ exp->exp_flags = flags;
+ spin_unlock_irqrestore(&exp->exp_lock, irqflags);
+
+ /* Disconnect early so that clients can't keep using export */
+ rc = class_disconnect(exp, flags);
+ ldlm_cancel_locks_for_export(exp);
/* complete all outstanding replies */
- spin_lock_irqsave (&export->exp_lock, irqflags);
- while (!list_empty (&export->exp_outstanding_replies)) {
+ spin_lock_irqsave(&exp->exp_lock, irqflags);
+ while (!list_empty(&exp->exp_outstanding_replies)) {
struct ptlrpc_reply_state *rs =
- list_entry (export->exp_outstanding_replies.next,
- struct ptlrpc_reply_state, rs_exp_list);
+ list_entry(exp->exp_outstanding_replies.next,
+ struct ptlrpc_reply_state, rs_exp_list);
struct ptlrpc_service *svc = rs->rs_srv_ni->sni_service;
- spin_lock (&svc->srv_lock);
- list_del_init (&rs->rs_exp_list);
- ptlrpc_schedule_difficult_reply (rs);
- spin_unlock (&svc->srv_lock);
+ spin_lock(&svc->srv_lock);
+ list_del_init(&rs->rs_exp_list);
+ ptlrpc_schedule_difficult_reply(rs);
+ spin_unlock(&svc->srv_lock);
}
- spin_unlock_irqrestore (&export->exp_lock, irqflags);
+ spin_unlock_irqrestore(&exp->exp_lock, irqflags);
- spin_lock_irqsave(&export->exp_lock, irqflags);
- export->exp_flags = flags;
- spin_unlock_irqrestore(&export->exp_lock, irqflags);
-
- rc = class_disconnect(export, flags);
+ class_export_put(exp);
RETURN(rc);
}
/* mds/mds_log.c */
-int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
+int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
struct lov_mds_md *lmm, int lmm_size,
struct llog_cookie *logcookies, int cookies_size);
-int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, int count,
- struct llog_logid *logid);
+int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, int count,
+ struct llog_catid *logid);
int mds_llog_finish(struct obd_device *obd, int count);
/* mds/mds_lov.c */
};
int mds_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *logid)
{
struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
int rc;
/* The following are visible and mutable through /proc/sys/lustre/. */
unsigned int obd_fail_loc;
unsigned int obd_timeout = 100;
-char obd_lustre_upcall[128] = "/usr/lib/lustre/lustre_upcall";
+char obd_lustre_upcall[128] = "DEFAULT"; /* or NONE or /full/path/to/upcall */
unsigned int obd_sync_filter; /* = 0, don't sync by default */
#ifdef __KERNEL__
return obd->u.cli.cl_import;
}
-
/* Export management functions */
static void export_handle_addref(void *export)
{
if (export == NULL) {
fixme();
- CDEBUG(D_IOCTL, "disconnect: attempting to free "
- "null export %p\n", export);
+ CDEBUG(D_IOCTL, "attempting to free NULL export %p\n", export);
RETURN(-EINVAL);
}
{
struct llog_handle *loghandle;
struct llog_log_hdr *llh;
- struct llog_logid_rec rec;
+ struct llog_logid_rec rec = { { 0 }, };
int rc, index, bitmap_size;
ENTRY;
/* loghandle is already locked by llog_cat_current_log() for us */
rc = llog_write_rec(loghandle, rec, reccookie, 1, buf, -1);
up_write(&loghandle->lgh_lock);
+ if (rc == -ENOSPC) {
+ /* to create a new plain log */
+ loghandle = llog_cat_current_log(cathandle, 1);
+ if (IS_ERR(loghandle))
+ RETURN(PTR_ERR(loghandle));
+ rc = llog_write_rec(loghandle, rec, reccookie, 1, buf, -1);
+ up_write(&loghandle->lgh_lock);
+ }
RETURN(rc);
}
#ifndef __LLOG_INTERNAL_H__
#define __LLOG_INTERNAL_H__
-int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
- char *name, int count, struct llog_logid *idarray);
-int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
- char *name, int count, struct llog_logid *);
+int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
+ char *name, int count, struct llog_catid *idarray);
int llog_cat_id2handle(struct llog_handle *cathandle, struct llog_handle **res,
struct llog_logid *logid);
#endif
struct obd_ioctl_data *data)
{
int size, i;
- struct llog_logid *idarray, *id;
- char name[32] = "CATLIST";
+ struct llog_catid *idarray;
+ struct llog_logid *id;
+ char name[32] = CATLIST;
char *out;
int l, remains, rc = 0;
out = data->ioc_bulk;
remains = data->ioc_inllen1;
- id = idarray;
for (i = 0; i < count; i++) {
+ id = &idarray[i].lci_logid;
l = snprintf(out, remains,
"catalog log: #"LPX64"#"LPX64"#%08x\n",
id->lgl_oid, id->lgl_ogr, id->lgl_ogen);
- id++;
out += l;
remains -= l;
if (remains <= 0) {
static int llog_lvfs_pad(struct obd_device *obd, struct l_file *file,
int len, int index)
{
- struct llog_rec_hdr rec;
+ struct llog_rec_hdr rec = { 0 };
struct llog_rec_tail tail;
int rc;
ENTRY;
/* record length should not bigger than LLOG_CHUNK_SIZE */
if (buf)
- rc = (reclen > LLOG_CHUNK_SIZE - sizeof(struct llog_rec_hdr)
- - sizeof(struct llog_rec_tail)) ? -E2BIG : 0;
+ rc = (reclen > LLOG_CHUNK_SIZE - sizeof(struct llog_rec_hdr) -
+ sizeof(struct llog_rec_tail)) ? -E2BIG : 0;
else
rc = (reclen > LLOG_CHUNK_SIZE) ? -E2BIG : 0;
if (rc)
/* NOTE: padding is a record, but no bit is set */
if (left != 0 && left != reclen &&
left < (reclen + LLOG_MIN_REC_SIZE)) {
+ int bitmap_size = sizeof(llh->llh_bitmap) * 8;
loghandle->lgh_last_idx++;
rc = llog_lvfs_pad(obd, file, left, loghandle->lgh_last_idx);
if (rc)
RETURN(rc);
+ /* if it's the last idx in log file, then return -ENOSPC */
+ if (loghandle->lgh_last_idx == bitmap_size - 1)
+ RETURN(-ENOSPC);
}
loghandle->lgh_last_idx++;
/* reads the catalog list */
int llog_get_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
- char *name, int count, struct llog_logid *idarray)
+ char *name, int count, struct llog_catid *idarray)
{
struct obd_run_ctxt saved;
struct l_file *file;
/* writes the cat list */
int llog_put_cat_list(struct obd_device *obd, struct obd_device *disk_obd,
- char *name, int count, struct llog_logid *idarray)
+ char *name, int count, struct llog_catid *idarray)
{
struct obd_run_ctxt saved;
struct l_file *file;
int llog_cat_initialize(struct obd_device *obd, int count)
{
- struct llog_logid *idarray;
+ struct llog_catid *idarray;
int size = sizeof(*idarray) * count;
- char name[32] = "CATLIST";
+ char name[32] = CATLIST;
int rc;
ENTRY;
if (!idarray)
RETURN(-ENOMEM);
- memset(idarray, 0, size);
-
rc = llog_get_cat_list(obd, obd, name, count, idarray);
if (rc) {
CERROR("rc: %d\n", rc);
EXPORT_SYMBOL(llog_cat_initialize);
int obd_llog_init(struct obd_device *obd, struct obd_device *disk_obd,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *logid)
{
int rc;
ENTRY;
static int llog_test_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *logid)
{
int rc;
ENTRY;
LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_finish);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, pin);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpin);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, invalidate_import);
+ LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
for (i = num_private_stats; i < num_stats; i++) {
RETURN(rc);
}
+/* Do extra sanity checks for grant accounting. We do this at connect,
+ * disconnect, and statfs RPC time, so it shouldn't be too bad. We can
+ * always get rid of it or turn it off when we know accounting is good. */
+static void filter_grant_sanity_check(struct obd_device *obd, char *func)
+{
+ struct filter_export_data *fed;
+ struct obd_export *exp;
+ obd_size maxsize = obd->obd_osfs.os_blocks * obd->obd_osfs.os_bsize;
+ obd_size tot_dirty = 0, tot_pending = 0, tot_granted = 0;
+ obd_size fo_tot_dirty, fo_tot_pending, fo_tot_granted;
+
+ spin_lock(&obd->obd_osfs_lock);
+ spin_lock(&obd->obd_dev_lock);
+ list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
+ fed = &exp->exp_filter_data;
+ LASSERTF(fed->fed_grant + fed->fed_pending <= maxsize,
+ "cli %s/%p %lu+%lu > "LPU64"\n",
+ exp->exp_client_uuid.uuid, exp,
+ fed->fed_grant, fed->fed_pending, maxsize);
+ LASSERTF(fed->fed_dirty <= maxsize, "cli %s/%p %lu > "LPU64"\n",
+ exp->exp_client_uuid.uuid, exp,fed->fed_dirty,maxsize);
+ CDEBUG(D_CACHE,"%s: cli %s/%p dirty %lu pend %lu grant %lu\n",
+ obd->obd_name, exp->exp_client_uuid.uuid, exp,
+ fed->fed_dirty, fed->fed_pending, fed->fed_grant);
+ tot_granted += fed->fed_grant + fed->fed_pending;
+ tot_pending += fed->fed_pending;
+ tot_dirty += fed->fed_dirty;
+ }
+ fo_tot_granted = obd->u.filter.fo_tot_granted;
+ fo_tot_pending = obd->u.filter.fo_tot_pending;
+ fo_tot_dirty = obd->u.filter.fo_tot_dirty;
+ spin_unlock(&obd->obd_dev_lock);
+ spin_unlock(&obd->obd_osfs_lock);
+
+ /* Do these assertions outside the spinlocks so we don't kill system */
+ LASSERTF(tot_granted == fo_tot_granted, "%s "LPU64" != "LPU64"\n",
+ func, tot_granted, fo_tot_granted);
+ LASSERTF(tot_pending == fo_tot_pending, "%s "LPU64" != "LPU64"\n",
+ func, tot_pending, fo_tot_pending);
+ LASSERTF(tot_dirty == fo_tot_dirty, "%s "LPU64" != "LPU64"\n",
+ func, tot_dirty, fo_tot_dirty);
+ LASSERTF(tot_pending <= tot_granted, "%s "LPU64" > "LPU64"\n",
+ func, tot_pending, tot_granted);
+ LASSERTF(tot_granted <= maxsize, "%s "LPU64" > "LPU64"\n",
+ func, tot_granted, maxsize);
+ LASSERTF(tot_dirty <= maxsize, "%s "LPU64" > "LPU64"\n",
+ func, tot_dirty, maxsize);
+}
+
+/* Remove this client from the grant accounting totals. This is done at
+ * disconnect time and also at export destroy time in case there was a race
+ * between removing the export and an incoming BRW updating the client grant.
+ * The client should do something similar when it invalidates its import. */
+static void filter_grant_discard(struct obd_export *exp)
+{
+ struct obd_device *obd = exp->exp_obd;
+ struct filter_obd *filter = &obd->u.filter;
+ struct filter_export_data *fed = &exp->exp_filter_data;
+
+ filter_grant_sanity_check(obd, __FUNCTION__);
+
+ spin_lock(&obd->obd_osfs_lock);
+ CDEBUG(D_CACHE, "%s: cli %s/%p dirty %lu pend %lu grant %lu\n",
+ obd->obd_name, exp->exp_client_uuid.uuid, exp,
+ fed->fed_dirty, fed->fed_pending, fed->fed_grant);
+
+ LASSERTF(filter->fo_tot_granted >= fed->fed_grant,
+ "%s: tot_granted "LPU64" cli %s/%p fed_grant %lu\n",
+ obd->obd_name, filter->fo_tot_granted,
+ exp->exp_client_uuid.uuid, exp, fed->fed_grant);
+ filter->fo_tot_granted -= fed->fed_grant;
+ LASSERTF(exp->exp_obd->u.filter.fo_tot_pending >= fed->fed_pending,
+ "%s: tot_pending "LPU64" cli %s/%p fed_pending %lu\n",
+ obd->obd_name, filter->fo_tot_pending,
+ exp->exp_client_uuid.uuid, exp, fed->fed_pending);
+ LASSERTF(filter->fo_tot_dirty >= fed->fed_dirty,
+ "%s: tot_dirty "LPU64" cli %s/%p fed_dirty %lu\n",
+ obd->obd_name, filter->fo_tot_dirty,
+ exp->exp_client_uuid.uuid, exp, fed->fed_dirty);
+ filter->fo_tot_dirty -= fed->fed_dirty;
+ fed->fed_dirty = 0;
+ fed->fed_grant = 0;
+
+ spin_unlock(&obd->obd_osfs_lock);
+}
+
static int filter_destroy_export(struct obd_export *exp)
{
ENTRY;
if (exp->exp_obd->obd_replayable)
filter_client_free(exp, exp->exp_flags);
+
+ filter_grant_sanity_check(exp->exp_obd, __FUNCTION__);
+
RETURN(0);
}
/* also incredibly similar to mds_disconnect */
static int filter_disconnect(struct obd_export *exp, int flags)
{
- struct filter_obd *filter = &exp->exp_obd->u.filter;
- struct filter_export_data *fed = &exp->exp_filter_data;
+ struct obd_device *obd = exp->exp_obd;
unsigned long irqflags;
struct llog_ctxt *ctxt;
int rc;
ENTRY;
LASSERT(exp);
-
- /* This would imply RPCs still in flight or preprw/commitrw imbalance */
- if (fed->fed_pending)
- CWARN("%s: cli %s has %lu pending at disconnect time\n",
- exp->exp_obd->obd_name, exp->exp_client_uuid.uuid,
- fed->fed_pending);
-
- /* Forget what this client had cached. This is also done on the
- * client when it invalidates its import. Do this before unlinking
- * from the export list so filter_grant_sanity_check totals are OK. */
- spin_lock(&exp->exp_obd->obd_osfs_lock);
- LASSERTF(exp->exp_obd->u.filter.fo_tot_dirty >= fed->fed_dirty,
- "%s: tot_dirty "LPU64" cli %s/%p fed_dirty %lu\n",
- exp->exp_obd->obd_name, exp->exp_obd->u.filter.fo_tot_dirty,
- exp->exp_client_uuid.uuid, exp, fed->fed_dirty);
- exp->exp_obd->u.filter.fo_tot_dirty -= fed->fed_dirty;
- LASSERTF(exp->exp_obd->u.filter.fo_tot_granted >= fed->fed_grant,
- "%s: tot_granted "LPU64" cli %s/%p fed_grant %lu\n",
- exp->exp_obd->obd_name, exp->exp_obd->u.filter.fo_tot_granted,
- exp->exp_client_uuid.uuid, exp, fed->fed_grant);
- exp->exp_obd->u.filter.fo_tot_granted -= fed->fed_grant;
- LASSERTF(exp->exp_obd->u.filter.fo_tot_pending >= fed->fed_pending,
- "%s: tot_pending "LPU64" cli %s/%p fed_pending %lu\n",
- exp->exp_obd->obd_name, exp->exp_obd->u.filter.fo_tot_pending,
- exp->exp_client_uuid.uuid, exp, fed->fed_pending);
- fed->fed_dirty = 0;
- fed->fed_grant = 0;
- spin_unlock(&exp->exp_obd->obd_osfs_lock);
-
- ldlm_cancel_locks_for_export(exp);
+ class_export_get(exp);
spin_lock_irqsave(&exp->exp_lock, irqflags);
exp->exp_flags = flags;
spin_unlock_irqrestore(&exp->exp_lock, irqflags);
- fsfilt_sync(exp->exp_obd, filter->fo_sb);
+ filter_grant_discard(exp);
+
+ /* Disconnect early so that clients can't keep using export */
+ rc = class_disconnect(exp, flags);
+
+ /* Do this twice in case a BRW arrived between the first call and
+ * the class_export_unlink() call (bug 2663) */
+ filter_grant_discard(exp);
+
+ ldlm_cancel_locks_for_export(exp);
+
+ fsfilt_sync(obd, obd->u.filter.fo_sb);
/* flush any remaining cancel messages out to the target */
- ctxt = llog_get_context(exp->exp_obd, LLOG_UNLINK_REPL_CTXT);
+ ctxt = llog_get_context(obd, LLOG_UNLINK_REPL_CTXT);
llog_sync(ctxt, exp);
- rc = class_disconnect(exp, flags);
+ class_export_put(exp);
RETURN(rc);
}
RETURN(rc);
}
-/* debugging to make sure that nothing bad happens, can be turned off soon.
- * caller must hold osfs lock */
-static void filter_grant_total_exports(struct obd_device *obd,
- obd_size *tot_dirty,
- obd_size *tot_pending,
- obd_size *tot_granted,
- obd_size maxsize)
-{
- struct filter_export_data *fed;
- struct obd_export *exp_pos;
-
- spin_lock(&obd->obd_dev_lock);
- list_for_each_entry(exp_pos, &obd->obd_exports, exp_obd_chain) {
- fed = &exp_pos->exp_filter_data;
- LASSERTF(fed->fed_dirty <= maxsize, "cli %s/%p %lu > "LPU64"\n",
- exp_pos->exp_client_uuid.uuid, exp_pos,
- fed->fed_dirty, maxsize);
- LASSERTF(fed->fed_grant + fed->fed_pending <= maxsize,
- "cli %s/%p %lu+%lu > "LPU64"\n",
- exp_pos->exp_client_uuid.uuid, exp_pos,
- fed->fed_grant, fed->fed_pending, maxsize);
- *tot_dirty += fed->fed_dirty;
- *tot_pending += fed->fed_pending;
- *tot_granted += fed->fed_grant + fed->fed_pending;
- }
- spin_unlock(&obd->obd_dev_lock);
-}
-
-static void filter_grant_sanity_check(obd_size tot_dirty, obd_size tot_pending,
- obd_size tot_granted,
- obd_size fo_tot_dirty,
- obd_size fo_tot_pending,
- obd_size fo_tot_granted, obd_size maxsize)
-{
- LASSERTF(tot_dirty == fo_tot_dirty, LPU64" != "LPU64"\n",
- tot_dirty, fo_tot_dirty);
- LASSERTF(tot_pending == fo_tot_pending, LPU64" != "LPU64"\n",
- tot_pending, fo_tot_pending);
- LASSERTF(tot_granted == fo_tot_granted, LPU64" != "LPU64"\n",
- tot_granted, fo_tot_granted);
- LASSERTF(tot_dirty <= maxsize, LPU64" > "LPU64"\n", tot_dirty, maxsize);
- LASSERTF(tot_pending <= tot_granted, LPU64" > "LPU64"\n", tot_pending,
- tot_granted);
- LASSERTF(tot_granted <= maxsize, LPU64" > "LPU64"\n",
- tot_granted, maxsize);
-}
-
static int filter_statfs(struct obd_device *obd, struct obd_statfs *osfs,
unsigned long max_age)
{
struct filter_obd *filter = &obd->u.filter;
- obd_size tot_cached = 0, tot_pending = 0, tot_granted = 0;
- obd_size fo_tot_cached, fo_tot_pending, fo_tot_granted;
int blockbits = filter->fo_sb->s_blocksize_bits;
int rc;
ENTRY;
spin_lock(&obd->obd_osfs_lock);
rc = fsfilt_statfs(obd, filter->fo_sb, max_age);
memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
- filter_grant_total_exports(obd, &tot_cached, &tot_pending, &tot_granted,
- osfs->os_blocks << blockbits);
- fo_tot_cached = filter->fo_tot_dirty;
- fo_tot_pending = filter->fo_tot_pending;
- fo_tot_granted = filter->fo_tot_granted;
spin_unlock(&obd->obd_osfs_lock);
- /* Do check outside spinlock, to avoid wedging system on failure */
- filter_grant_sanity_check(tot_cached, tot_pending, tot_granted,
- fo_tot_cached, fo_tot_pending,
- fo_tot_granted, osfs->os_blocks << blockbits);
-
CDEBUG(D_SUPER | D_CACHE, "blocks cached "LPU64" granted "LPU64
"pending "LPU64" free "LPU64" avail "LPU64"\n",
- tot_cached >> blockbits, tot_granted >> blockbits,
- tot_pending >> blockbits, osfs->os_bfree, osfs->os_bavail);
+ filter->fo_tot_dirty >> blockbits,
+ filter->fo_tot_granted >> blockbits,
+ filter->fo_tot_pending >> blockbits,
+ osfs->os_bfree, osfs->os_bavail);
+
+ filter_grant_sanity_check(obd, __FUNCTION__);
osfs->os_bavail -= min(osfs->os_bavail,
- (tot_cached +tot_pending +osfs->os_bsize -1) >>
- blockbits);
+ (filter->fo_tot_dirty + filter->fo_tot_pending +
+ osfs->os_bsize -1) >> blockbits);
RETURN(rc);
}
};
static int filter_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *logid)
{
struct llog_ctxt *ctxt;
int rc;
struct obd_device *obd = exp->exp_obd;
ENTRY;
+ LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+
if ((oa->o_valid & (OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) !=
(OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) {
oa->o_valid &= ~OBD_MD_FLGRANT;
* leave this here in case there is a large error in accounting. */
CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ?
D_ERROR : D_CACHE,
- "%s: cli %s reports granted: "LPU64" dropped: %u, local: %lu\n",
- obd->obd_name, exp->exp_client_uuid.uuid, oa->o_grant,
+ "%s: cli %s/%p reports grant: "LPU64" dropped: %u, local: %lu\n",
+ obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_grant,
oa->o_dropped, fed->fed_grant);
/* Update our accounting now so that statfs takes it into account.
* on fed_dirty however. */
obd->u.filter.fo_tot_dirty += oa->o_dirty - fed->fed_dirty;
if (fed->fed_grant < oa->o_dropped) {
- CERROR("%s: cli %s reports %u dropped > fed_grant %lu\n",
- obd->obd_name, exp->exp_client_uuid.uuid,
+ CERROR("%s: cli %s/%p reports %u dropped > fed_grant %lu\n",
+ obd->obd_name, exp->exp_client_uuid.uuid, exp,
oa->o_dropped, fed->fed_grant);
oa->o_dropped = 0;
}
if (obd->u.filter.fo_tot_granted < oa->o_dropped) {
- CERROR("%s: cli %s reports %u dropped > tot_granted "LPU64"\n",
- obd->obd_name, exp->exp_client_uuid.uuid,
+ CERROR("%s: cli %s/%p reports %u dropped > tot_grant "LPU64"\n",
+ obd->obd_name, exp->exp_client_uuid.uuid, exp,
oa->o_dropped, obd->u.filter.fo_tot_granted);
oa->o_dropped = 0;
}
obd_size tot_granted = obd->u.filter.fo_tot_granted, avail, left = 0;
int rc, statfs_done = 0;
+ LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+
if (time_before(obd->obd_osfs_age, jiffies - HZ)) {
restat:
rc = fsfilt_statfs(obd, obd->u.filter.fo_sb, jiffies + 1);
if (left < tot_granted - obd->u.filter.fo_tot_pending &&
time_after(jiffies, next)) {
spin_unlock(&obd->obd_osfs_lock);
- CERROR("%s: cli %s granted "LPU64" more than available "
+ CERROR("%s: cli %s/%p grant "LPU64" > available "
LPU64" and pending "LPU64"\n", obd->obd_name,
- exp->exp_client_uuid.uuid, tot_granted, left,
- obd->u.filter.fo_tot_pending);
+ exp->exp_client_uuid.uuid, exp, tot_granted,
+ left, obd->u.filter.fo_tot_pending);
if (next == 0)
portals_debug_dumplog();
next = jiffies + 20 * HZ;
left = 0;
}
- CDEBUG(D_CACHE, "%s: cli %s free: "LPU64" avail: "LPU64" grant "LPU64
+ CDEBUG(D_CACHE, "%s: cli %s/%p free: "LPU64" avail: "LPU64" grant "LPU64
" left: "LPU64" pending: "LPU64"\n", obd->obd_name,
- exp->exp_client_uuid.uuid, obd->obd_osfs.os_bfree << blockbits,
- avail << blockbits, tot_granted, left,
- obd->u.filter.fo_tot_pending);
+ exp->exp_client_uuid.uuid, exp,
+ obd->obd_osfs.os_bfree << blockbits, avail << blockbits,
+ tot_granted, left, obd->u.filter.fo_tot_pending);
return left;
}
int blockbits = obd->u.filter.fo_sb->s_blocksize_bits;
__u64 grant = 0;
+ LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+
/* Grant some fraction of the client's requested grant space so that
* they are not always waiting for write credits (not all of it to
* avoid overgranting in face of multiple RPCs in flight). This
}
}
- CDEBUG(D_CACHE,"%s: cli %s wants: "LPU64" granting: "LPU64"\n",
- obd->obd_name, exp->exp_client_uuid.uuid, want, grant);
+ CDEBUG(D_CACHE,"%s: cli %s/%p wants: "LPU64" granting: "LPU64"\n",
+ obd->obd_name, exp->exp_client_uuid.uuid, exp, want, grant);
CDEBUG(D_CACHE,
- "%s: cli %s tot cached:"LPU64" granted:"LPU64
+ "%s: cli %s/%p tot cached:"LPU64" granted:"LPU64
" num_exports: %d\n", obd->obd_name, exp->exp_client_uuid.uuid,
- obd->u.filter.fo_tot_dirty,
+ exp, obd->u.filter.fo_tot_dirty,
obd->u.filter.fo_tot_granted, obd->obd_num_exports);
return grant;
unsigned long used = 0, ungranted = 0, using;
int i, rc = -ENOSPC, obj, n = 0, mask = D_CACHE;
+ LASSERT_SPIN_LOCKED(&exp->exp_obd->obd_osfs_lock);
+
for (obj = 0; obj < objcount; obj++) {
for (i = 0; i < fso[obj].fso_bufcnt; i++, n++) {
int tmp, bytes;
if (rnb[n].flags & OBD_BRW_FROM_GRANT) {
if (fed->fed_grant < used + bytes) {
CDEBUG(D_CACHE,
- "%s: cli %s claims %ld+%d GRANT,"
- " no such grant %lu, idx %d\n",
+ "%s: cli %s/%p claims %ld+%d "
+ "GRANT, real grant %lu idx %d\n",
exp->exp_obd->obd_name,
- exp->exp_client_uuid.uuid,
+ exp->exp_client_uuid.uuid, exp,
used, bytes, fed->fed_grant, n);
mask = D_ERROR;
} else {
* ignore this error. */
lnb[n].rc = -ENOSPC;
rnb[n].flags &= OBD_BRW_GRANTED;
- CDEBUG(D_CACHE, "%s: cli %s idx %d no space for %d\n",
+ CDEBUG(D_CACHE,"%s: cli %s/%p idx %d no space for %d\n",
exp->exp_obd->obd_name,
- exp->exp_client_uuid.uuid, n, bytes);
+ exp->exp_client_uuid.uuid, exp, n, bytes);
}
}
exp->exp_obd->u.filter.fo_tot_pending += used;
CDEBUG(mask,
- "%s: cli %s used: %lu ungranted: %lu grant: %lu dirty: %lu\n",
- exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, used,
+ "%s: cli %s/%p used: %lu ungranted: %lu grant: %lu dirty: %lu\n",
+ exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp, used,
ungranted, fed->fed_grant, fed->fed_dirty);
/* Rough calc in case we don't refresh cached statfs data */
exp->exp_obd->obd_osfs.os_bavail = 0;
if (fed->fed_dirty < used) {
- CERROR("%s: cli %s claims used %lu > fed_dirty %lu\n",
- exp->exp_obd->obd_name, exp->exp_client_uuid.uuid,
+ CERROR("%s: cli %s/%p claims used %lu > fed_dirty %lu\n",
+ exp->exp_obd->obd_name, exp->exp_client_uuid.uuid, exp,
used, fed->fed_dirty);
used = fed->fed_dirty;
}
int *eof, void *data)
{
struct obd_device *obd = data;
- struct obd_export *exp;
- if (obd == NULL || list_empty(&obd->obd_exports))
+ if (obd == NULL)
return 0;
- spin_lock(&obd->obd_dev_lock);
- exp = list_entry(obd->obd_exports.next, struct obd_export,
- exp_obd_chain);
- spin_unlock(&obd->obd_dev_lock);
-
return snprintf(page, count, "%d\n",
- exp->exp_osc_data.oed_oscc.oscc_kick_barrier);
+ obd->u.cli.cl_oscc.oscc_kick_barrier);
}
int osc_wr_create_low_wm(struct file *file, const char *buffer,
unsigned long count, void *data)
{
struct obd_device *obd = data;
- struct obd_export *exp;
int val, rc;
- if (obd == NULL || list_empty(&obd->obd_exports))
+ if (obd == NULL)
return 0;
rc = lprocfs_write_helper(buffer, count, &val);
return -ERANGE;
spin_lock(&obd->obd_dev_lock);
- exp = list_entry(obd->obd_exports.next, struct obd_export,
- exp_obd_chain);
- exp->exp_osc_data.oed_oscc.oscc_kick_barrier = val;
+ obd->u.cli.cl_oscc.oscc_kick_barrier = val;
spin_unlock(&obd->obd_dev_lock);
return count;
int *eof, void *data)
{
struct obd_device *obd = data;
- struct obd_export *exp;
- if (obd == NULL || list_empty(&obd->obd_exports))
+ if (obd == NULL)
return 0;
- spin_lock(&obd->obd_dev_lock);
- exp = list_entry(obd->obd_exports.next, struct obd_export,
- exp_obd_chain);
- spin_unlock(&obd->obd_dev_lock);
-
return snprintf(page, count, "%d\n",
- exp->exp_osc_data.oed_oscc.oscc_grow_count);
+ obd->u.cli.cl_oscc.oscc_grow_count);
}
int osc_wr_create_count(struct file *file, const char *buffer,
unsigned long count, void *data)
{
struct obd_device *obd = data;
- struct obd_export *exp;
int val, rc;
- if (obd == NULL || list_empty(&obd->obd_exports))
+ if (obd == NULL)
return 0;
rc = lprocfs_write_helper(buffer, count, &val);
if (val < 0)
return -ERANGE;
- spin_lock(&obd->obd_dev_lock);
- exp = list_entry(obd->obd_exports.next, struct obd_export,
- exp_obd_chain);
- exp->exp_osc_data.oed_oscc.oscc_grow_count = val;
- spin_unlock(&obd->obd_dev_lock);
+ obd->u.cli.cl_oscc.oscc_grow_count = val;
return count;
}
int *eof, void *data)
{
struct obd_device *obd = data;
- struct obd_export *exp;
- if (obd == NULL || list_empty(&obd->obd_exports))
+ if (obd == NULL)
return 0;
- spin_lock(&obd->obd_dev_lock);
- exp = list_entry(obd->obd_exports.next, struct obd_export,
- exp_obd_chain);
- spin_unlock(&obd->obd_dev_lock);
-
return snprintf(page, count, LPU64"\n",
- exp->exp_osc_data.oed_oscc.oscc_next_id);
+ obd->u.cli.cl_oscc.oscc_next_id);
}
int osc_rd_prealloc_last_id(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_device *obd = data;
- struct obd_export *exp;
- if (obd == NULL || list_empty(&obd->obd_exports))
+ if (obd == NULL)
return 0;
- spin_lock(&obd->obd_dev_lock);
- exp = list_entry(obd->obd_exports.next, struct obd_export,
- exp_obd_chain);
- spin_unlock(&obd->obd_dev_lock);
-
return snprintf(page, count, LPU64"\n",
- exp->exp_osc_data.oed_oscc.oscc_last_id);
+ obd->u.cli.cl_oscc.oscc_last_id);
}
static struct lprocfs_vars lprocfs_obd_vars[] = {
oscc->oscc_flags |= OSCC_FLAG_CREATING;
spin_unlock(&oscc->oscc_lock);
- request = ptlrpc_prep_req(class_exp2cliimp(oscc->oscc_exp), OST_CREATE,
+ request = ptlrpc_prep_req(oscc->oscc_obd->u.cli.cl_import, OST_CREATE,
1, &size, NULL);
if (request == NULL) {
spin_lock(&oscc->oscc_lock);
ost_full = (oscc->oscc_flags & OSCC_FLAG_NOSPC);
spin_unlock(&oscc->oscc_lock);
- osc_invalid = class_exp2cliimp(oscc->oscc_exp)->imp_invalid;
-
+ osc_invalid = oscc->oscc_obd->u.cli.cl_import->imp_invalid;
+
return have_objs || ost_full || osc_invalid;
}
if (!oscc_has_objects(oscc, 1) && (oscc->oscc_flags & OSCC_FLAG_NOSPC))
rc = -ENOSPC;
- if (class_exp2cliimp(oscc->oscc_exp)->imp_invalid)
+ if (oscc->oscc_obd->u.cli.cl_import->imp_invalid)
rc = -EIO;
RETURN(rc);
struct lov_stripe_md **ea, struct obd_trans_info *oti)
{
struct lov_stripe_md *lsm;
- struct osc_creator *oscc = &exp->u.eu_osc_data.oed_oscc;
+ struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
int try_again = 1, rc = 0;
ENTRY;
LASSERT(oa);
oa->o_valid |= OBD_MD_FLID;
oa->o_id = oscc->oscc_next_id - 1;
- rc = osc_real_create(oscc->oscc_exp, oa, ea, NULL);
+ rc = osc_real_create(exp, oa, ea, NULL);
spin_lock(&oscc->oscc_lock);
if (rc == -ENOSPC)
RETURN(rc);
}
-void oscc_init(struct obd_export *exp)
+void oscc_init(struct obd_device *obd)
{
- struct osc_export_data *oed;
+ struct osc_creator *oscc;
- if (exp == NULL)
+ if (obd == NULL)
return;
- oed = &exp->exp_osc_data;
- memset(oed, 0, sizeof(*oed));
- INIT_LIST_HEAD(&oed->oed_oscc.oscc_list);
- init_waitqueue_head(&oed->oed_oscc.oscc_waitq);
- spin_lock_init(&oed->oed_oscc.oscc_lock);
- oed->oed_oscc.oscc_exp = exp;
- oed->oed_oscc.oscc_kick_barrier = 100;
- oed->oed_oscc.oscc_grow_count = 2000;
- oed->oed_oscc.oscc_initial_create_count = 2000;
-
- oed->oed_oscc.oscc_next_id = 2;
- oed->oed_oscc.oscc_last_id = 1;
- oed->oed_oscc.oscc_flags |= OSCC_FLAG_RECOVERING;
+ oscc = &obd->u.cli.cl_oscc;
+
+ memset(oscc, 0, sizeof(*oscc));
+ INIT_LIST_HEAD(&oscc->oscc_list);
+ init_waitqueue_head(&oscc->oscc_waitq);
+ spin_lock_init(&oscc->oscc_lock);
+ oscc->oscc_obd = obd;
+ oscc->oscc_kick_barrier = 100;
+ oscc->oscc_grow_count = 2000;
+ oscc->oscc_initial_create_count = 2000;
+
+ oscc->oscc_next_id = 2;
+ oscc->oscc_last_id = 1;
+ oscc->oscc_flags |= OSCC_FLAG_RECOVERING;
/* XXX the export handle should give the oscc the last object */
/* oed->oed_oscc.oscc_last_id = exph->....; */
}
struct lov_stripe_md **ea, struct obd_trans_info *oti);
int osc_real_create(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md **ea, struct obd_trans_info *oti);
-void oscc_init(struct obd_export *exp);
+void oscc_init(struct obd_device *obd);
void osc_wake_cache_waiters(struct client_obd *cli);
#ifdef __KERNEL__
void *key, obd_count vallen, void *val)
{
struct ptlrpc_request *req;
+ struct obd_device *obd = exp->exp_obd;
struct obd_import *imp = class_exp2cliimp(exp);
struct llog_ctxt *ctxt;
int rc, size = keylen;
memcmp(key, "next_id", strlen("next_id")) == 0) {
if (vallen != sizeof(obd_id))
RETURN(-EINVAL);
- exp->u.eu_osc_data.oed_oscc.oscc_next_id = *((obd_id*)val) + 1;
+ obd->u.cli.cl_oscc.oscc_next_id = *((obd_id*)val) + 1;
CDEBUG(D_INODE, "%s: set oscc_next_id = "LPU64"\n",
exp->exp_obd->obd_name,
- exp->u.eu_osc_data.oed_oscc.oscc_next_id);
+ obd->u.cli.cl_oscc.oscc_next_id);
RETURN(0);
}
memcmp(key, "growth_count", strlen("growth_count")) == 0) {
if (vallen != sizeof(int))
RETURN(-EINVAL);
- exp->u.eu_osc_data.oed_oscc.oscc_grow_count = *((int*)val);
+ obd->u.cli.cl_oscc.oscc_grow_count = *((int*)val);
RETURN(0);
}
if (keylen == strlen("unlinked") &&
memcmp(key, "unlinked", keylen) == 0) {
- struct osc_creator *oscc = &exp->u.eu_osc_data.oed_oscc;
+ struct osc_creator *oscc = &obd->u.cli.cl_oscc;
spin_lock(&oscc->oscc_lock);
oscc->oscc_flags &= ~OSCC_FLAG_NOSPC;
spin_unlock(&oscc->oscc_lock);
imp->imp_server_timeout = 1;
CDEBUG(D_HA, "pinging OST %s\n", imp->imp_target_uuid.uuid);
- ptlrpc_pinger_add_import(imp);
+ imp->imp_pingable = 1;
RETURN(rc);
}
static struct llog_operations osc_unlink_orig_logops;
static int osc_llog_init(struct obd_device *obd, struct obd_device *tgt,
- int count, struct llog_logid *logid)
+ int count, struct llog_catid *catid)
{
int rc;
ENTRY;
osc_unlink_orig_logops.lop_add = llog_obd_origin_add;
osc_unlink_orig_logops.lop_connect = llog_origin_connect;
- rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, count, logid,
- &osc_unlink_orig_logops);
+ rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, count,
+ &catid->lci_logid, &osc_unlink_orig_logops);
if (rc)
RETURN(rc);
struct obd_device *obd, struct obd_uuid *cluuid)
{
int rc;
- struct obd_export *exp;
rc = client_connect_import(exph, obd, cluuid);
- if (obd->u.cli.cl_conn_count == 1) {
- exp = class_conn2export(exph);
- oscc_init(exp);
- }
-
return rc;
}
struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_SIZE_REPL_CTXT);
int rc;
- if (obd->u.cli.cl_conn_count == 1) {
+ if (obd->u.cli.cl_conn_count == 1)
/* flush any remaining cancel messages out to the target */
llog_sync(ctxt, exp);
- /* balance the conn2export for oscc in osc_connect */
- class_export_put(exp);
- }
-
rc = client_disconnect_export(exp, flags);
return rc;
}
-static int osc_invalidate_import(struct obd_device *obd,
- struct obd_import *imp)
+static int osc_import_event(struct obd_device *obd,
+ struct obd_import *imp,
+ enum obd_import_event event)
{
struct client_obd *cli;
+ int rc = 0;
+
LASSERT(imp->imp_obd == obd);
- /* this used to try and tear down queued pages, but it was
- * not correctly implemented. We'll have to do it again once
- * we call obd_invalidate_import() agian */
- /* XXX And we still need to do this */
- /* Reset grants, too */
- cli = &obd->u.cli;
- spin_lock(&cli->cl_loi_list_lock);
- cli->cl_avail_grant = 0;
- cli->cl_lost_grant = 0;
- spin_unlock(&cli->cl_loi_list_lock);
+ switch (event) {
+ case IMP_EVENT_DISCON: {
+ /* Only do this on the MDS OSC's */
+ if (imp->imp_server_timeout) {
+ struct osc_creator *oscc = &obd->u.cli.cl_oscc;
+
+ spin_lock(&oscc->oscc_lock);
+ oscc->oscc_flags |= OSCC_FLAG_RECOVERING;
+ spin_unlock(&oscc->oscc_lock);
+ }
+ break;
+ }
+ case IMP_EVENT_INVALIDATE: {
+ struct ldlm_namespace *ns = obd->obd_namespace;
- RETURN(0);
+ /* this used to try and tear down queued pages, but it was
+ * not correctly implemented. We'll have to do it again once
+ * we call obd_invalidate_import() agian */
+ /* XXX And we still need to do this */
+
+ /* Reset grants, too */
+ cli = &obd->u.cli;
+ spin_lock(&cli->cl_loi_list_lock);
+ cli->cl_avail_grant = 0;
+ cli->cl_lost_grant = 0;
+ spin_unlock(&cli->cl_loi_list_lock);
+
+ ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
+
+ if (obd->obd_observer)
+ rc = obd_notify(obd->obd_observer, obd, 0);
+ break;
+ }
+ case IMP_EVENT_ACTIVE: {
+ if (obd->obd_observer)
+ rc = obd_notify(obd->obd_observer, obd, 1);
+ break;
+ }
+ default:
+ CERROR("Unknown import event %d\n", event);
+ LBUG();
+ }
+ RETURN(rc);
}
int osc_setup(struct obd_device *obd, obd_count len, void *buf)
rc = client_obd_setup(obd, len, buf);
if (rc)
ptlrpcd_decref();
+ else
+ oscc_init(obd);
+
RETURN(rc);
}
o_iocontrol: osc_iocontrol,
o_get_info: osc_get_info,
o_set_info: osc_set_info,
- o_invalidate_import: osc_invalidate_import,
+ o_import_event: osc_import_event,
o_llog_init: osc_llog_init,
o_llog_finish: osc_llog_finish,
};
o_cancel: osc_cancel,
o_cancel_unused:osc_cancel_unused,
o_iocontrol: osc_iocontrol,
- o_invalidate_import: osc_invalidate_import,
+ o_import_event: osc_import_event,
o_llog_init: osc_llog_init,
o_llog_finish: osc_llog_finish,
};
#define LASSERTF(cond, fmt...) do { } while (0)
#endif
+#ifdef CONFIG_SMP
+#define LASSERT_SPIN_LOCKED(lock) LASSERT(spin_is_locked(lock))
+#else
+#define LASSERT_SPIN_LOCKED(lock) do {} while(0)
+#endif
+
#ifdef __arch_um__
#define LBUG_WITH_LOC(file, func, line) \
do { \
static const char *portal_debug_subsystems[] =
{"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
"rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter",
- "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL};
+ "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", "ibnal",
+ NULL};
static const char *portal_debug_masks[] =
{"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
"blocks", "net", "warning", "buffs", "other", "dentry", "portals",
*status = -EIO;
}
else if (req->rq_send_state != imp->imp_state) {
- if (imp->imp_obd->obd_no_recov || imp->imp_dlm_fake)
+ if (imp->imp_obd->obd_no_recov || imp->imp_dlm_fake
+ || req->rq_no_delay)
*status = -EWOULDBLOCK;
else
delay = 1;
req->rq_waiting = 1;
spin_unlock (&req->rq_lock);
+ DEBUG_REQ(D_HA, req, "req from PID %d waiting for recovery: "
+ "(%s != %s)",
+ req->rq_reqmsg->status,
+ ptlrpc_import_state_name(req->rq_send_state),
+ ptlrpc_import_state_name(imp->imp_state));
LASSERT(list_empty (&req->rq_list));
- // list_del(&req->rq_list);
list_add_tail(&req->rq_list, &imp->imp_delayed_list);
spin_unlock_irqrestore(&imp->imp_lock, flags);
RETURN(0);
static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked);
void ptlrpc_req_finished_with_imp_lock(struct ptlrpc_request *request)
{
-#ifdef CONFIG_SMP
- LASSERT(spin_is_locked(&request->rq_import->imp_lock));
-#endif
+ LASSERT_SPIN_LOCKED(&request->rq_import->imp_lock);
(void)__ptlrpc_req_finished(request, 1);
}
LASSERT(imp != NULL);
-#ifdef CONFIG_SMP
- LASSERT(spin_is_locked(&imp->imp_lock));
-#endif
+ LASSERT_SPIN_LOCKED(&imp->imp_lock);
CDEBUG(D_HA, "%s: committing for last_committed "LPU64"\n",
imp->imp_obd->obd_name, imp->imp_peer_committed_transno);
}
ptlrpc_wake_client_req(req);
spin_unlock_irqrestore (&req->rq_lock, flags);
-
}
/* XXX: this function and rq_status are currently unused */
{
struct list_head *tmp;
-#ifdef CONFIG_SMP
- LASSERT(spin_is_locked(&imp->imp_lock));
-#endif
+ LASSERT_SPIN_LOCKED(&imp->imp_lock);
/* don't re-add requests that have been replayed */
if (!list_empty(&req->rq_replay_list))
if (imp->imp_state == LUSTRE_IMP_FULL) {
IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_DISCON);
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
+ obd_import_event(imp->imp_obd, imp, IMP_EVENT_DISCON);
rc = 1;
} else {
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
CDEBUG(D_HA, "%p %s: import already not connected: %s\n",
imp,imp->imp_client->cli_name,
ptlrpc_import_state_name(imp->imp_state));
}
- spin_unlock_irqrestore(&imp->imp_lock, flags);
return rc;
}
+void ptlrpc_invalidate_import(struct obd_import *imp)
+{
+ struct obd_device *obd = imp->imp_obd;
+ unsigned long flags;
+ ENTRY;
+
+ spin_lock_irqsave(&imp->imp_lock, flags);
+ /* This is a bit of a hack, but invalidating replayable
+ * imports makes a temporary reconnect failure into a much more
+ * ugly -- and hard to remedy -- situation. */
+ if (!imp->imp_replayable) {
+ CDEBUG(D_HA, "setting import %s INVALID\n",
+ imp->imp_target_uuid.uuid);
+ imp->imp_invalid = 1;
+ }
+ imp->imp_generation++;
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
+
+ ptlrpc_abort_inflight(imp);
+ obd_import_event(obd, imp, IMP_EVENT_INVALIDATE);
+}
+
+void ptlrpc_validate_import(struct obd_import *imp)
+{
+ struct obd_device *obd = imp->imp_obd;
+ unsigned long flags;
+
+ spin_lock_irqsave(&imp->imp_lock, flags);
+ imp->imp_invalid = 0;
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
+
+ obd_import_event(obd, imp, IMP_EVENT_ACTIVE);
+}
+
void ptlrpc_fail_import(struct obd_import *imp, int generation)
{
ENTRY;
LASSERT (!imp->imp_dlm_fake);
- if (ptlrpc_set_import_discon(imp))
- ptlrpc_handle_failed_import(imp);
+ if (ptlrpc_set_import_discon(imp)) {
+ unsigned long flags;
+ if (!imp->imp_replayable) {
+ CDEBUG(D_HA, "import %s@%s for %s not replayable, "
+ "auto-deactivating\n",
+ imp->imp_target_uuid.uuid,
+ imp->imp_connection->c_remote_uuid.uuid,
+ imp->imp_obd->obd_name);
+ ptlrpc_invalidate_import(imp);
+ }
+
+ CDEBUG(D_HA, "%s: waking up pinger\n",
+ imp->imp_target_uuid.uuid);
+
+ spin_lock_irqsave(&imp->imp_lock, flags);
+ imp->imp_force_verify = 1;
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
+
+ ptlrpc_pinger_wake_up();
+
+ }
EXIT;
}
if (msg_flags & MSG_CONNECT_REPLAYABLE) {
CDEBUG(D_HA, "connected to replayable target: %s\n",
imp->imp_target_uuid.uuid);
- imp->imp_replayable = 1;
- ptlrpc_pinger_add_import(imp);
+ imp->imp_pingable = imp->imp_replayable = 1;
} else {
imp->imp_replayable = 0;
}
imp->imp_remote_handle = request->rq_repmsg->handle;
IMPORT_SET_STATE(imp, LUSTRE_IMP_FULL);
+ ptlrpc_pinger_add_import(imp);
GOTO(finish, rc = 0);
}
finish:
rc = ptlrpc_import_recovery_state_machine(imp);
if (rc != 0) {
- if (aa->pcaa_was_invalid) {
- ptlrpc_set_import_active(imp, 0);
- }
+ if (aa->pcaa_was_invalid)
+ ptlrpc_invalidate_import(imp);
if (rc == -ENOTCONN) {
CDEBUG(D_HA, "evicted/aborted by %s@%s during recovery;"
if (rc != 0) {
IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
if (aa->pcaa_initial_connect && !imp->imp_initial_recov) {
- ptlrpc_set_import_active(imp, 0);
- GOTO(norecov, rc);
+ ptlrpc_invalidate_import(imp);
}
- CDEBUG(D_ERROR,
- "recovery of %s on %s failed (%d); restarting\n",
+ CDEBUG(D_ERROR, "recovery of %s on %s failed (%d)\n",
imp->imp_target_uuid.uuid,
(char *)imp->imp_connection->c_remote_uuid.uuid, rc);
- ptlrpc_handle_failed_import(imp);
}
-norecov:
wake_up(&imp->imp_recovery_waitq);
RETURN(rc);
}
CDEBUG(D_HA, "evicted from %s@%s; invalidating\n",
imp->imp_target_uuid.uuid,
imp->imp_connection->c_remote_uuid.uuid);
- ptlrpc_set_import_active(imp, 0);
+ ptlrpc_invalidate_import(imp);
IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER);
}
imp->imp_target_uuid.uuid,
imp->imp_connection->c_remote_uuid.uuid);
- ptlrpc_set_import_active(imp, 1);
+ ptlrpc_validate_import(imp);
rc = ptlrpc_resend(imp);
if (rc)
GOTO(out, rc);
/* For non-replayable connections, don't attempt
reconnect if this fails */
if (!imp->imp_replayable) {
- IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
- request->rq_send_state = LUSTRE_IMP_DISCON;
+ request->rq_no_resend = 1;
+ IMPORT_SET_STATE(imp, LUSTRE_IMP_CONNECTING);
+ request->rq_send_state = LUSTRE_IMP_CONNECTING;
}
request->rq_replen = lustre_msg_size(0, NULL);
rc = ptlrpc_queue_wait(request);
struct obd_run_ctxt saved;
struct llog_ctxt *ctxt;
__u32 flags;
- __u8 *buf;
int size[] = {sizeof (*hdr)};
int rc, rc2;
ENTRY;
GOTO(out, rc =-EFAULT);
}
- OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
- if (!buf)
- GOTO(out, rc = -ENOMEM);
-
ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
LASSERT(ctxt != NULL);
disk_obd = ctxt->loc_exp->exp_obd;
if (rc)
GOTO(out_close, rc);
-
rc = lustre_pack_reply(req, 1, size, NULL);
if (rc)
GOTO(out_close, rc = -ENOMEM);
out_pop:
pop_ctxt(&saved, &disk_obd->obd_ctxt, NULL);
- OBD_FREE(buf, LLOG_CHUNK_SIZE);
out:
RETURN(rc);
struct llog_handle *handle;
struct obd_run_ctxt saved;
int size, i, count;
- struct llog_logid *idarray, *id;
- char name[32] = "CATLIST";
+ struct llog_catid *idarray;
+ struct llog_logid *id;
+ char name[32] = CATLIST;
int rc;
struct cb_data data;
struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
OBD_ALLOC(idarray, size);
if (!idarray)
RETURN(-ENOMEM);
- memset(idarray, 0, size);
rc = llog_get_cat_list(obd, obd, name, count, idarray);
if (rc)
push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
- id = idarray;
data.ctxt = ctxt;
data.out = buf;
data.remains = buf_len;
for (i = 0; i < count; i++) {
int l, index, uncanceled = 0;
+
+ id = &idarray[i].lci_logid;
rc = llog_create(ctxt, &handle, id, NULL);
if (rc)
GOTO(out_pop, rc);
LASSERT (request->rq_replen != 0);
if (request->rq_repmsg == NULL)
OBD_ALLOC(request->rq_repmsg, request->rq_replen);
- if (request->rq_repmsg == NULL) {
- LBUG();
+ if (request->rq_repmsg == NULL)
GOTO(cleanup_bulk, rc = -ENOMEM);
- }
rc = PtlMEAttach(connection->c_peer.peer_ni->pni_ni_h,
request->rq_reply_portal, /* XXX FIXME bug 249 */
if (rc != PTL_OK) {
CERROR("PtlMEAttach failed: %d\n", rc);
LASSERT (rc == PTL_NOSPACE);
- LBUG();
GOTO(cleanup_repmsg, rc = -ENOMEM);
}
if (rc != PTL_OK) {
CERROR("PtlMDAttach failed: %d\n", rc);
LASSERT (rc == PTL_NOSPACE);
- LBUG();
GOTO(cleanup_me, rc -ENOMEM);
}
void lustre_assert_wire_constants(void)
{
/* Wire protocol assertions generated by 'wirecheck'
- * running on Linux adevi 2.4.18-p4smp-10pre1 #1 SMP Thu Feb 5 14:52:15 PST 2004 i686 unknown
- * with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113) */
+ * running on Linux schnapps.adilger.int 2.4.22-l32 #4 Thu Jan 8 14:32:57 MST 2004 i686 i686
+ * with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) */
/* Constants... */
(long long)LLOG_GEN_REC);
LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n",
(long long)LLOG_HDR_MAGIC);
- LASSERTF(LLOG_LOGID_MAGIC == 275010874, " found %lld\n",
+ LASSERTF(LLOG_LOGID_MAGIC == 275010875, " found %lld\n",
(long long)LLOG_LOGID_MAGIC);
+ /* Checks for struct llog_catid */
+ LASSERTF((int)sizeof(struct llog_catid) == 32, " found %lld\n",
+ (long long)(int)sizeof(struct llog_catid));
+ LASSERTF(offsetof(struct llog_catid, lci_logid) == 0, " found %lld\n",
+ (long long)offsetof(struct llog_catid, lci_logid));
+ LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n",
+ (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid));
+
/* Checks for struct llog_rec_hdr */
LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n",
(long long)(int)sizeof(struct llog_rec_hdr));
(long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_index));
/* Checks for struct llog_logid_rec */
- LASSERTF((int)sizeof(struct llog_logid_rec) == 48, " found %lld\n",
+ LASSERTF((int)sizeof(struct llog_logid_rec) == 64, " found %lld\n",
(long long)(int)sizeof(struct llog_logid_rec));
LASSERTF(offsetof(struct llog_logid_rec, lid_hdr) == 0, " found %lld\n",
(long long)offsetof(struct llog_logid_rec, lid_hdr));
(long long)offsetof(struct llog_logid_rec, lid_id));
LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n",
(long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id));
- LASSERTF(offsetof(struct llog_logid_rec, lid_tail) == 40, " found %lld\n",
+ LASSERTF(offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n",
(long long)offsetof(struct llog_logid_rec, lid_tail));
LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n",
(long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_tail));
#ifdef __KERNEL__
static struct ptlrpc_thread *pinger_thread = NULL;
+int ptlrpc_ping(struct obd_import *imp)
+{
+ struct ptlrpc_request *req;
+ int rc = 0;
+ ENTRY;
+
+ req = ptlrpc_prep_req(imp, OBD_PING, 0, NULL,
+ NULL);
+ if (req) {
+ DEBUG_REQ(D_HA, req, "pinging %s->%s",
+ imp->imp_obd->obd_uuid.uuid,
+ imp->imp_target_uuid.uuid);
+ req->rq_no_resend = req->rq_no_delay = 1;
+ req->rq_replen = lustre_msg_size(0,
+ NULL);
+ ptlrpcd_add_req(req);
+ } else {
+ CERROR("OOM trying to ping %s->%s\n",
+ imp->imp_obd->obd_uuid.uuid,
+ imp->imp_target_uuid.uuid);
+ rc = -ENOMEM;
+ }
+
+ RETURN(rc);
+}
+
static int ptlrpc_pinger_main(void *arg)
{
struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg;
long time_to_next_ping;
struct l_wait_info lwi = LWI_TIMEOUT(obd_timeout * HZ,
NULL, NULL);
- struct ptlrpc_request_set *set;
- struct ptlrpc_request *req;
struct list_head *iter;
- wait_queue_t set_wait;
- int rc;
- set = ptlrpc_prep_set();
down(&pinger_sem);
list_for_each(iter, &pinger_imports) {
struct obd_import *imp =
list_entry(iter, struct obd_import,
imp_pinger_chain);
- int generation, level;
+ int force, level;
unsigned long flags;
- if (imp->imp_next_ping <= this_ping) {
- /* Add a ping. */
- spin_lock_irqsave(&imp->imp_lock, flags);
- generation = imp->imp_generation;
- level = imp->imp_state;
- spin_unlock_irqrestore(&imp->imp_lock, flags);
-
- if (level != LUSTRE_IMP_FULL) {
- CDEBUG(D_HA,
- "not pinging %s (in recovery)\n",
- imp->imp_target_uuid.uuid);
- continue;
- }
-
- req = ptlrpc_prep_req(imp, OBD_PING, 0, NULL,
- NULL);
- if (!req) {
- CERROR("OOM trying to ping\n");
- break;
- }
- req->rq_no_resend = 1;
- req->rq_replen = lustre_msg_size(0, NULL);
- req->rq_send_state = LUSTRE_IMP_FULL;
- req->rq_phase = RQ_PHASE_RPC;
- req->rq_import_generation = generation;
- ptlrpc_set_add_req(set, req);
- } else {
- CDEBUG(D_HA, "don't need to ping %s (%lu > "
- "%lu)\n", imp->imp_target_uuid.uuid,
- imp->imp_next_ping, this_ping);
- }
- }
- up(&pinger_sem);
-
- /* Might be empty, that's OK. */
- if (set->set_remaining == 0)
- CDEBUG(D_HA, "nothing to ping\n");
- list_for_each(iter, &set->set_requests) {
- struct ptlrpc_request *req =
- list_entry(iter, struct ptlrpc_request,
- rq_set_chain);
- DEBUG_REQ(D_HA, req, "pinging %s->%s",
- req->rq_import->imp_obd->obd_uuid.uuid,
- req->rq_import->imp_target_uuid.uuid);
- (void)ptl_send_rpc(req);
- }
-
- /* Have to wait on both the thread's queue and the set's. */
- init_waitqueue_entry(&set_wait, current);
- add_wait_queue(&set->set_waitq, &set_wait);
- rc = l_wait_event(thread->t_ctl_waitq,
- thread->t_flags & SVC_STOPPING ||
- ptlrpc_check_set(set),
- &lwi);
- remove_wait_queue(&set->set_waitq, &set_wait);
- CDEBUG(D_HA, "ping complete (%lu)\n", jiffies);
-
- if (thread->t_flags & SVC_STOPPING) {
- thread->t_flags &= ~SVC_STOPPING;
- list_for_each(iter, &set->set_requests) {
- req = list_entry(iter, struct ptlrpc_request,
- rq_set_chain);
- if (!req->rq_replied)
- ptlrpc_unregister_reply(req);
- }
- ptlrpc_set_destroy(set);
- EXIT;
- break;
- }
- /* Expire all the requests that didn't come back. */
- down(&pinger_sem);
- list_for_each(iter, &set->set_requests) {
- req = list_entry(iter, struct ptlrpc_request,
- rq_set_chain);
+ spin_lock_irqsave(&imp->imp_lock, flags);
+ level = imp->imp_state;
+ force = imp->imp_force_verify;
+ if (force)
+ imp->imp_force_verify = 0;
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
- if (req->rq_replied)
- continue;
+ if (imp->imp_next_ping <= this_ping || force) {
+ if (level == LUSTRE_IMP_DISCON) {
+ /* wait at least a timeout before
+ trying recovery again. */
+ imp->imp_next_ping = jiffies +
+ (obd_timeout * HZ);
+ ptlrpc_initiate_recovery(imp);
+ }
+ else if (level != LUSTRE_IMP_FULL) {
+ CDEBUG(D_HA,
+ "not pinging %s "
+ "(in recovery: %s)\n",
+ imp->imp_target_uuid.uuid,
+ ptlrpc_import_state_name(level));
+ }
+ else if (imp->imp_pingable || force) {
+ ptlrpc_ping(imp);
+ }
- req->rq_phase = RQ_PHASE_COMPLETE;
- set->set_remaining--;
- /* If it was disconnected, don't sweat it. */
- if (list_empty(&req->rq_import->imp_pinger_chain)) {
- ptlrpc_unregister_reply(req);
- continue;
+ } else {
+ if (imp->imp_pingable)
+ CDEBUG(D_HA, "don't need to ping %s "
+ "(%lu > %lu)\n",
+ imp->imp_target_uuid.uuid,
+ imp->imp_next_ping, this_ping);
}
-
- ptlrpc_expire_one_request(req);
}
up(&pinger_sem);
- ptlrpc_set_destroy(set);
/* Wait until the next ping time, or until we're stopped. */
time_to_next_ping = this_ping + (obd_timeout * HZ) - jiffies;
list_add_tail(&imp->imp_pinger_chain, &pinger_imports);
class_import_get(imp);
-#ifdef ENABLE_PINGER
- pinger_thread->t_flags |= SVC_EVENT;
- wake_up(&pinger_thread->t_ctl_waitq);
-#endif
+ ptlrpc_pinger_wake_up();
up(&pinger_sem);
RETURN(0);
RETURN(0);
}
+void ptlrpc_pinger_wake_up()
+{
+#ifdef ENABLE_PINGER
+ pinger_thread->t_flags |= SVC_EVENT;
+ wake_up(&pinger_thread->t_ctl_waitq);
+#endif
+}
+
#else
/* XXX
* the current implementation of pinger in liblustre is not optimized
RETURN(0);
}
+void ptlrpc_pinger_wake_up()
+{
+#ifdef ENABLE_PINGER
+ /* XXX force pinger to run, if needed */
+#endif
+}
#endif /* !__KERNEL__ */
int ptlrpc_set_import_discon(struct obd_import *imp);
void ptlrpc_handle_failed_import(struct obd_import *imp);
int ptlrpc_replay_next(struct obd_import *imp, int *inflight);
+void ptlrpc_initiate_recovery(struct obd_import *imp);
#ifdef __KERNEL__
int ptlrpc_start_pinger(void);
int ptlrpc_stop_pinger(void);
void ptlrpc_pinger_sending_on_import(struct obd_import *imp);
+void ptlrpc_pinger_wake_up(void);
#endif /* PTLRPC_INTERNAL_H */
EXPORT_SYMBOL(ptlrpc_resend);
EXPORT_SYMBOL(ptlrpc_wake_delayed);
EXPORT_SYMBOL(ptlrpc_set_import_active);
+EXPORT_SYMBOL(ptlrpc_invalidate_import);
EXPORT_SYMBOL(ptlrpc_fail_import);
EXPORT_SYMBOL(ptlrpc_fail_export);
EXPORT_SYMBOL(ptlrpc_recover_import);
#endif
}
+/* This might block waiting for the upcall to start, so it should
+ * not be called from a thread that shouldn't block. (Like ptlrpcd) */
+void ptlrpc_initiate_recovery(struct obd_import *imp)
+{
+ ENTRY;
+
+ LASSERT (obd_lustre_upcall != NULL);
+
+ if (strcmp(obd_lustre_upcall, "DEFAULT") == 0) {
+ CDEBUG(D_ERROR, "%s: starting recovery without upcall\n",
+ imp->imp_target_uuid.uuid);
+ ptlrpc_connect_import(imp, NULL);
+ }
+ else if (strcmp(obd_lustre_upcall, "NONE") == 0) {
+ CDEBUG(D_ERROR, "%s: recovery diabled\n",
+ imp->imp_target_uuid.uuid);
+ }
+ else {
+ CDEBUG(D_ERROR, "%s: calling upcall to start recovery\n",
+ imp->imp_target_uuid.uuid);
+ ptlrpc_run_failed_import_upcall(imp);
+ }
+
+ EXIT;
+}
+
int ptlrpc_replay_next(struct obd_import *imp, int *inflight)
{
int rc = 0;
spin_unlock_irqrestore(&imp->imp_lock, flags);
}
-inline void ptlrpc_invalidate_import_state(struct obd_import *imp)
-{
- struct obd_device *obd = imp->imp_obd;
- struct ldlm_namespace *ns = obd->obd_namespace;
-
- ptlrpc_abort_inflight(imp);
-
- obd_invalidate_import(obd, imp);
-
- ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
-}
-
-void ptlrpc_handle_failed_import(struct obd_import *imp)
-{
- ENTRY;
-
- if (!imp->imp_replayable) {
- CDEBUG(D_HA,
- "import %s@%s for %s not replayable, deactivating\n",
- imp->imp_target_uuid.uuid,
- imp->imp_connection->c_remote_uuid.uuid,
- imp->imp_obd->obd_name);
- ptlrpc_set_import_active(imp, 0);
- }
-
- ptlrpc_run_failed_import_upcall(imp);
- EXIT;
-}
-
void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)
{
int rc;
EXIT;
}
+/*
+ * This should only be called by the ioctl interface, currently
+ * with the lctl deactivate and activate commands.
+ */
int ptlrpc_set_import_active(struct obd_import *imp, int active)
{
struct obd_device *obd = imp->imp_obd;
unsigned long flags;
+ int rc = 0;
LASSERT(obd);
/* When deactivating, mark import invalid, and abort in-flight
* requests. */
if (!active) {
- spin_lock_irqsave(&imp->imp_lock, flags);
- /* This is a bit of a hack, but invalidating replayable
- * imports makes a temporary reconnect failure into a much more
- * ugly -- and hard to remedy -- situation. */
- if (!imp->imp_replayable) {
- CDEBUG(D_HA, "setting import %s INVALID\n",
- imp->imp_target_uuid.uuid);
- imp->imp_invalid = 1;
- }
- imp->imp_generation++;
- spin_unlock_irqrestore(&imp->imp_lock, flags);
- ptlrpc_invalidate_import_state(imp);
- }
+ ptlrpc_invalidate_import(imp);
+ }
- /* When activating, mark import valid */
+ /* When activating, mark import valid, and attempt recovery */
if (active) {
CDEBUG(D_HA, "setting import %s VALID\n",
imp->imp_target_uuid.uuid);
spin_lock_irqsave(&imp->imp_lock, flags);
imp->imp_invalid = 0;
spin_unlock_irqrestore(&imp->imp_lock, flags);
- }
- if (obd->obd_observer)
- RETURN(obd_notify(obd->obd_observer, obd, active));
+ rc = ptlrpc_recover_import(imp, NULL);
+ if (rc) {
+ spin_lock_irqsave(&imp->imp_lock, flags);
+ imp->imp_invalid = 1;
+ spin_unlock_irqrestore(&imp->imp_lock, flags);
+ }
+ }
- RETURN(0);
+ RETURN(rc);
}
int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid)
date=`date +%Y%m%d_%H%M`
module=lustre
+case $parent in
+ HEAD) : ;;
+ b_*|b1*) : ;;
+ *) parent="b_$parent" ;;
+esac
+case $child in
+ HEAD) : ;;
+ b_*|b1*) : ;;
+ *) child="b_$child"
+esac
+
if [ "$parent" != "HEAD" -a "`cat CVS/Tag`" != "T$parent" ]; then
echo "This script must be run within the $parent branch"
exit 1
dir=$3
-if [ $parent != "HEAD" ]; then
- parent="b_$parent"
-fi
-if [ $child != "HEAD" ]; then
- child="b_$child"
-fi
-
cat << EOF > .mergeinfo
parent=$parent
PARENT=$PARENT
echo "done"
echo "Test, commit and then run land2.sh (no arguments)"
-
# lustre.spec
-%define version b1_2
+%define version 4pre1.2.0
%define kversion @LINUXRELEASE@
%define linuxdir @LINUX@
%define enable_doc @ENABLE_DOC@
LUSTRE=${LUSTRE:-`dirname $0`/..}
RLUSTRE=${RLUSTRE:-$LUSTRE}
+MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
. $LUSTRE/tests/test-framework.sh
}
run_test 14 "test mkfsoptions of ost for lmc and lconf"
+test_15() {
+ start_ost
+ start_mds
+ echo "mount lustre on ${MOUNT} with $MOUNTLUSTRE....."
+ [ -f "$MOUNTLUSTRE" ] && rm -f $MOUNTLUSTRE
+ [ ! `cp $LUSTRE/utils/llmount $MOUNTLUSTRE` ] || return $?
+ do_node `hostname` mkdir $MOUNT 2> /dev/null || :
+ do_node `hostname` mount -t lustre -o nettype=$NETTYPE `facet_active_host mds`:/mds_svc/client_facet $MOUNT || return $?
+ echo "mount lustre on ${MOUNT} with $MOUNTLUSTRE: success"
+ [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
+ check_mount || return 41
+ cleanup || return $?
+
+ start_ost
+ start_mds
+ [ -f "$MOUNTLUSTRE" ] && rm -f $MOUNTLUSTRE
+ echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
+ do_node `hostname` mkdir $MOUNT 2> /dev/null || :
+ do_node `hostname` mount -t lustre -o nettype=$NETTYPE `facet_active_host mds`:/mds_svc/client_facet $MOUNT && return $?
+ echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE should return error: success"
+ [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
+ check_mount || return 41
+ cleanup || return $?
+
+}
+run_test 15 "zconf-mount without /sbin/mount.lustre, should return error"
+
equals_msg "Done"
test_5() {
drop_request "mv $MOUNT/resolv.conf $MOUNT/renamed" || return 1
drop_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
+ do_facet client "checkstat -v $MOUNT/renamed-again" || return 3
}
run_test 5 "rename: drop req, drop rep"
#b=2494
test_12(){
$LCTL mark multiop $MOUNT/$tfile OS_c
+ do_facet mds "sysctl -w lustre.fail_loc=0x115"
+ clear_failloc mds $((TIMEOUT * 2)) &
multiop $MOUNT/$tfile OS_c &
PID=$!
#define OBD_FAIL_MDS_CLOSE_NET 0x115
- do_facet mds "sysctl -w lustre.fail_loc=0x115"
- clear_failloc mds $((TIMEOUT * 2)) &
+ sleep 2
kill -USR1 $PID
echo "waiting for multiop $PID"
wait $PID || return 2
test_27a() {
echo '== stripe sanity =============================================='
mkdir $DIR/d27
- $LSTRIPE $DIR/d27/f0 8192 0 1 || error
+ $LSTRIPE $DIR/d27/f0 65536 0 1 || error
$CHECKSTAT -t file $DIR/d27/f0 || error
pass
log "== test_27b: write to one stripe file ========================="
if [ ! -d $DIR/d27 ]; then
mkdir $DIR/d27
fi
- $LSTRIPE $DIR/d27/f01 8192 0 2 || error
+ $LSTRIPE $DIR/d27/f01 65536 0 2 || error
[ `$LFIND $DIR/d27/f01 | grep -A 10 obdidx | wc -l` -eq 4 ] ||
error "two-stripe file doesn't have two stripes"
pass
if [ ! -d $DIR/d27 ]; then
mkdir $DIR/d27
fi
- $LSTRIPE $DIR/d27/f12 8192 0 2 || error
- $LSTRIPE $DIR/d27/f12 8192 0 2 && error
+ $LSTRIPE $DIR/d27/f12 65536 0 2 || error
+ $LSTRIPE $DIR/d27/f12 65536 0 2 && error
$CHECKSTAT -t file $DIR/d27/f12 || error
}
run_test 27e "lstripe existing file (should return error) ======"
if [ ! -d $DIR/d27 ]; then
mkdir $DIR/d27
fi
- $LSTRIPE $DIR/d27/f27j 8192 $STRIPECOUNT 1 && error || true
+ $LSTRIPE $DIR/d27/f27j 65536 $STRIPECOUNT 1 && error || true
}
run_test 27j "lstripe with bad stripe offset (should return error)"
[ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
done
[ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
- error "`od -a $DIR1/f10` != abcdefghijkl"
+ error "`od -a $DIR1/f9` != abcdefghijkl"
}
run_test 9 "append of file with sub-page size on multiple mounts"
init_options(struct lustre_mount_data *lmd)
{
memset(lmd, 0, sizeof(lmd));
+ lmd->lmd_magic = LMD_MAGIC;
lmd->lmd_server_nid = PTL_NID_ANY;
lmd->lmd_local_nid = PTL_NID_ANY;
lmd->lmd_port = 988; /* XXX define LUSTRE_DEFAULT_PORT */
int val;
char *opt;
char * opteq;
-
+
/* parsing ideas here taken from util-linux/mount/nfsmount.c */
for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) {
if ((opteq = strchr(opt, '='))) {
rc = get_local_elan_id(pfiles[i], buf);
} while (rc != 0 &&
pfiles[++i] != NULL);
-
+
if (rc != 0) {
fprintf(stderr, "mount: can't read elan ID"
" from /proc\n");
}
if (ptl_parse_nid (&nid, buf) != 0) {
- fprintf (stderr, "mount: can't parse NID %s\n",
+ fprintf (stderr, "mount: can't parse NID %s\n",
buf);
return (-1);
}
char *s;
int rc;
+ if (lmd_bad_magic(lmd))
+ return -EINVAL;
+
if (strlen(source) > sizeof(target) + 1) {
fprintf(stderr, "mount: "
"exessively long host:/mds/profile argument\n");
}
strcpy(lmd->lmd_profile, profile);
-
if (verbose)
print_options(lmd);
return 0;
}
void
+check_llog_catid(void)
+{
+ BLANK_LINE();
+ CHECK_STRUCT(llog_catid);
+ CHECK_MEMBER(llog_catid, lci_logid);
+}
+
+void
check_llog_rec_hdr(void)
{
BLANK_LINE();
check_ptlbd_niob();
check_ptlbd_rsp();
check_llog_logid();
+ check_llog_catid();
check_llog_rec_hdr();
check_llog_rec_tail();
check_llog_logid_rec();
void lustre_assert_wire_constants(void)
{
/* Wire protocol assertions generated by 'wirecheck'
- * running on Linux adevi 2.4.18-p4smp-10pre1 #1 SMP Thu Feb 5 14:52:15 PST 2004 i686 unknown
- * with gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113) */
+ * running on Linux schnapps.adilger.int 2.4.22-l32 #4 Thu Jan 8 14:32:57 MST 2004 i686 i686
+ * with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) */
/* Constants... */
(long long)LLOG_GEN_REC);
LASSERTF(LLOG_HDR_MAGIC == 275010873, " found %lld\n",
(long long)LLOG_HDR_MAGIC);
- LASSERTF(LLOG_LOGID_MAGIC == 275010874, " found %lld\n",
+ LASSERTF(LLOG_LOGID_MAGIC == 275010875, " found %lld\n",
(long long)LLOG_LOGID_MAGIC);
+ /* Checks for struct llog_catid */
+ LASSERTF((int)sizeof(struct llog_catid) == 32, " found %lld\n",
+ (long long)(int)sizeof(struct llog_catid));
+ LASSERTF(offsetof(struct llog_catid, lci_logid) == 0, " found %lld\n",
+ (long long)offsetof(struct llog_catid, lci_logid));
+ LASSERTF((int)sizeof(((struct llog_catid *)0)->lci_logid) == 20, " found %lld\n",
+ (long long)(int)sizeof(((struct llog_catid *)0)->lci_logid));
+
/* Checks for struct llog_rec_hdr */
LASSERTF((int)sizeof(struct llog_rec_hdr) == 16, " found %lld\n",
(long long)(int)sizeof(struct llog_rec_hdr));
(long long)(int)sizeof(((struct llog_rec_tail *)0)->lrt_index));
/* Checks for struct llog_logid_rec */
- LASSERTF((int)sizeof(struct llog_logid_rec) == 48, " found %lld\n",
+ LASSERTF((int)sizeof(struct llog_logid_rec) == 64, " found %lld\n",
(long long)(int)sizeof(struct llog_logid_rec));
LASSERTF(offsetof(struct llog_logid_rec, lid_hdr) == 0, " found %lld\n",
(long long)offsetof(struct llog_logid_rec, lid_hdr));
(long long)offsetof(struct llog_logid_rec, lid_id));
LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_id) == 20, " found %lld\n",
(long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_id));
- LASSERTF(offsetof(struct llog_logid_rec, lid_tail) == 40, " found %lld\n",
+ LASSERTF(offsetof(struct llog_logid_rec, lid_tail) == 56, " found %lld\n",
(long long)offsetof(struct llog_logid_rec, lid_tail));
LASSERTF((int)sizeof(((struct llog_logid_rec *)0)->lid_tail) == 8, " found %lld\n",
(long long)(int)sizeof(((struct llog_logid_rec *)0)->lid_tail));