tags
TAGS
lustre*.tar.gz
+cscope.files
+cscope.out
- credentials weren't being shipped for readdir/getattr operations
- remove invalid assertions triggered during some concurrent MD
updates
+ - proper Lustre versions added (336, 389)
+ - fix memory leak for create error case (398)
+ - fix LOV locking bug that would get cli/srv out of sync
+ - fix echo client over LOV (409)
+ - fix dbench 2, extN refcount problem (170, 258, 356, 418)
+ - fix double-O_EXCL intent crash (424)
2002-11-18 Phil Schwan <phil@clusterfs.com>
* version v0_5_17
DIRS24 = extN mds
endif
-# NOTE: keep extN before mds
-SUBDIRS = lov utils obdclass ldlm ptlrpc lib obdecho mdc osc ost llite
-SUBDIRS+= $(DIRS24) obdfilter tests doc scripts
+# NOTE: keep extN before mds and obdfilter
+SUBDIRS = $(DIRS24) obdclass utils ptlrpc ldlm lib obdfilter mdc osc ost llite
+SUBDIRS+= obdecho lov tests doc scripts
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = BUGS FDL Rules include patches archdep.m4
rpms: dist Makefile
rpm -ta $(distdir).tar.gz
-
-
be 4 digits, and can correspond to test RPM's, and lead up to the
package version. So let's plan on releasing
-So you'd build 2 sets of test rpms this week:
+So you'd build 2 sets of test rpms this week:
0.0.9.1
0.0.9.2
-we decide it's fine then and we release
+we decide it's fine then and we release
0.1.0
-We go on developing with
+We go on developing with
-0.1.0.{1,2,3,4,...}
+0.1.0.{1,2,3,4,...}
-as test releases and then we release:
+as test releases and then we release:
0.1.1
Versions will have 4 digits:
major.minor.patch.test
-Such versions will be tagged in CVS as:
+Such versions will be tagged in CVS as:
v1_2_11_7
and referred to as:
1.2.11.7
encoded as:
0x01021107
-Usage:
+Usage:
------
-New numbers are used as follows:
+New numbers are used as follows:
-1. major:
+1. major:
- increased when major new functionality becomes available
-2. minor:
+2. minor:
- even: for each new release with new functionality
- odd : when a new development cycle starts after a release
3. patch:
- when a development snapshot or release update becomes available
- all these are announced on lustre-devel@lists.sf.net
-4. test:
+4. test:
- when developers feel it is time to exchange a named version
-What will run, what won't ?
+What will run, what won't ?
---------------------------
1. If the test level is non-zero, i.e. there are 4 digits in the
version, no guarantees of any kind are made.
-2. For three digit releases/tags the code should perform
+2. For three digit releases/tags the code should perform
according to the announcement.
Moving tags
Branches
--------
-For even minor releases a branch tag will be created. The branch tag
-will be of the form:
+Any and all development must be done on branches, and can only merge to the
+HEAD if _at_least_ tests/acceptance-small.sh and IOR with 5 SMP nodes and
+2 clients/node with 1GB file/client pass without any errors or cleanup
+problems. Additional tests may be added in the future, so the tests in the
+current CVS head must pass before a branch can be merged back to the trunk.
-bmajor_minor
-
-Note that the CVS head is where development is going. If developers
-use a branch they must eventually merge that back into the head.
-Typically this is done by importing changes into the branch and
-removing the sticky tags:
-
-cvs update -A
-
-fixing any conflicts and then committing.
+See http://lustre.org/docs/branches.html for details on CVS branch usage.
extN_jbd.h
extN_xattr.h
xattr.h
+lustre_build_version.h
#define LDLM_NAMESPACE_SERVER 0
#define LDLM_NAMESPACE_CLIENT 1
-#define LDLM_FL_LOCK_CHANGED (1 << 0)
+#define LDLM_FL_LOCK_CHANGED (1 << 0) /* extent, mode, or resource changed */
+
+/* If the server returns one of these flags, then the lock was put on that list.
+ * If the client sends one of these flags (during recovery ONLY!), it wants the
+ * lock added to the specified list, no questions asked. -p */
#define LDLM_FL_BLOCK_GRANTED (1 << 1)
#define LDLM_FL_BLOCK_CONV (1 << 2)
#define LDLM_FL_BLOCK_WAIT (1 << 3)
-#define LDLM_FL_CBPENDING (1 << 4)
-#define LDLM_FL_AST_SENT (1 << 5)
-#define LDLM_FL_DESTROYED (1 << 6)
-#define LDLM_FL_WAIT_NOREPROC (1 << 7)
-#define LDLM_FL_CANCEL (1 << 8)
+
+#define LDLM_FL_CBPENDING (1 << 4) // this lock is being destroyed
+#define LDLM_FL_AST_SENT (1 << 5) // blocking or cancel packet was sent
+#define LDLM_FL_DESTROYED (1 << 6) // this lock is destroyed
+#define LDLM_FL_WAIT_NOREPROC (1 << 7)// not a real lock flag,not saved in lock
+#define LDLM_FL_CANCEL (1 << 8) // cancellation callback already run
+
+/* Lock is being replayed. This could probably be implied by the fact that one
+ * of BLOCK_{GRANTED,CONV,WAIT} is set, but that is pretty dangerous. */
#define LDLM_FL_REPLAY (1 << 9)
+
#define LDLM_FL_INTENT_ONLY (1 << 10) /* don't grant lock, just do intent */
#define LDLM_FL_LOCAL_ONLY (1 << 11) /* see ldlm_cli_cancel_unused */
#define LDLM_FL_NO_CALLBACK (1 << 12) /* see ldlm_cli_cancel_unused */
#define LDLM_FL_HAS_INTENT (1 << 13) /* lock request has intent */
-#define LDLM_FL_REDUCE (1 << 14) /* throw away unused locks */
-#define LDLM_FL_CANCELING (1 << 15) /* lock is being canceled */
+#define LDLM_FL_CANCELING (1 << 14) /* lock cancel has already been sent */
+/* The blocking callback is overloaded to perform two functions. These flags
+ * indicate which operation should be performed. */
#define LDLM_CB_BLOCKING 1
#define LDLM_CB_CANCELING 2
ldlm_mode_t mode, int flags, void *data));
void ldlm_unregister_intent(void);
void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh);
-struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *, int strict, int flags);
-void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh);
+struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *, int strict,
+ int flags);
void ldlm_cancel_callback(struct ldlm_lock *);
int ldlm_lock_set_data(struct lustre_handle *, void *data, int datalen);
void l_lock_init(struct lustre_lock *);
void l_lock(struct lustre_lock *);
void l_unlock(struct lustre_lock *);
+int l_has_lock(struct lustre_lock *);
#define CB_PHASE_START 12
#define CB_PHASE_FINISH 13
/* simple.c */
struct obd_run_ctxt;
struct obd_ucred;
-void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new,
+void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx,
struct obd_ucred *cred);
-void pop_ctxt(struct obd_run_ctxt *saved);
+void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx,
+ struct obd_ucred *cred);
struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode);
struct dentry *simple_mknod(struct dentry *dir, char *name, int mode);
int lustre_fread(struct file *file, char *str, int len, loff_t *off);
#define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 139 )
+#define OBD_GET_VERSION _IOWR ('f', 144, long)
+
/*
* l_wait_event is a flexible sleeping function, permitting simple caller
* configuration of interrupt and timeout sensitivity along with actions to
int mds_update_unpack(struct ptlrpc_request *, int offset,
struct mds_update_record *);
-void mds_readdir_pack(struct ptlrpc_request *req, int offset,
+void mds_readdir_pack(struct ptlrpc_request *req, __u64 offset,
obd_id ino, int type);
void mds_getattr_pack(struct ptlrpc_request *req, int offset,
struct inode *inode, const char *name, int namelen);
struct list_head c_imports;
struct list_head c_exports;
struct list_head c_sb_chain;
- __u32 c_flags; /* can we indicate INVALID elsewhere? */
+ __u32 c_flags; // can we indicate INVALID elsewhere?
};
struct ptlrpc_client {
__u32 cli_target_devno;
void *cli_data;
- // struct semaphore cli_rpc_sem; /* limits outstanding requests */
-
char *cli_name;
};
int rq_flags;
atomic_t rq_refcount;
- int rq_request_portal; /* XXX FIXME bug 625069 */
- int rq_reply_portal; /* XXX FIXME bug 625069 */
+ int rq_request_portal; /* XXX FIXME bug 249 */
+ int rq_reply_portal; /* XXX FIXME bug 249 */
int rq_reqlen;
struct lustre_msg *rq_reqmsg;
#ifndef __OBD_H
#define __OBD_H
-#include <linux/fs.h>
-#include <linux/list.h>
-#include <linux/smp_lock.h>
-#include <linux/proc_fs.h>
-
-#include <linux/lustre_lib.h>
-#include <linux/lustre_idl.h>
-#include <linux/lustre_mds.h>
-#include <linux/lustre_export.h>
-
-struct obd_type {
- struct list_head typ_chain;
- struct obd_ops *typ_ops;
- struct proc_dir_entry *typ_procroot;
- char *typ_name;
- int typ_refcnt;
-};
-
-struct brw_page {
- struct page *pg;
- obd_size count;
- obd_off off;
- obd_flag flag;
-};
struct lov_oinfo { /* per-child structure */
__u64 loi_id; /* object ID on the target OST */
struct lov_oinfo lsm_oinfo[0];
};
+#ifdef __KERNEL__
+# include <linux/fs.h>
+# include <linux/list.h>
+# include <linux/smp_lock.h>
+# include <linux/proc_fs.h>
+
+# include <linux/lustre_lib.h>
+# include <linux/lustre_idl.h>
+# include <linux/lustre_mds.h>
+# include <linux/lustre_export.h>
+
+struct obd_type {
+ struct list_head typ_chain;
+ struct obd_ops *typ_ops;
+ struct proc_dir_entry *typ_procroot;
+ char *typ_name;
+ int typ_refcnt;
+};
+
+struct brw_page {
+ struct page *pg;
+ obd_size count;
+ obd_off off;
+ obd_flag flag;
+};
+
/* Individual type definitions */
struct ext2_obd {
return vfs_statfs(mds->mds_sb, sfs);
}
-
-#endif
+#endif /* __KERNEL */
+#endif /* __OBD_H */
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, get_info);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, set_info);
static inline int obd_setup(struct obd_device *obd, int datalen, void *data)
{
int rc;
+ ENTRY;
OBD_CHECK_OP(obd, setup);
static inline int obd_cleanup(struct obd_device *obd)
{
int rc;
+ ENTRY;
OBD_CHECK_DEVSETUP(obd);
OBD_CHECK_OP(obd, cleanup);
struct lov_stripe_md *mem_src)
{
struct obd_export *exp;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, packmd);
struct lov_mds_md *wire_src)
{
struct obd_export *exp;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, unpackmd);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, create);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, destroy);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, getattr);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, close);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, open);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, setattr);
ptlrpc_recovery_cb_t recover)
{
int rc;
+ ENTRY;
OBD_CHECK_DEVSETUP(obd);
OBD_CHECK_OP(obd, connect);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, disconnect);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, statfs);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, punch);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, brw);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, preprw);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, commitrw);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, iocontrol);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, enqueue);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, cancel);
{
struct obd_export *exp;
int rc;
+ ENTRY;
OBD_CHECK_SETUP(conn, exp);
OBD_CHECK_OP(exp->exp_obd, cancel_unused);
#define OBD_ALLOC(ptr, size) \
do { \
+ void *lptr; \
long s = (size); \
- (ptr) = kmalloc(s, GFP_KERNEL); \
- if ((ptr) == NULL) { \
+ (ptr) = lptr = kmalloc(s, GFP_KERNEL); \
+ if (lptr == NULL) { \
CERROR("kmalloc of '" #ptr "' (%ld bytes) failed " \
"at %s:%d\n", s, __FILE__, __LINE__); \
} else { \
- memset((ptr), 0, s); \
+ memset(lptr, 0, s); \
obd_memory += s; \
CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at " \
- "%p (tot %ld).\n", s, (ptr), obd_memory); \
+ "%p (tot %ld).\n", s, lptr, obd_memory); \
} \
} while (0)
+#ifdef CONFIG_DEBUG_SLAB
+#define POISON(lptr, s) do {} while (0)
+#else
+#define POISON(lptr, s) memset(lptr, 0xb6, s)
+#endif
+
#define OBD_FREE(ptr, size) \
do { \
+ void *lptr = (ptr); \
int s = (size); \
- LASSERT(ptr); \
- kfree((ptr)); \
+ LASSERT(lptr); \
+ POISON(lptr, s); \
+ kfree(lptr); \
obd_memory -= s; \
CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %ld).\n", \
- s, (ptr), obd_memory); \
+ s, lptr, obd_memory); \
(ptr) = (void *)0xdeadbeef; \
} while (0)
*
*/
-
-
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
void l_lock(struct lustre_lock *lock)
{
int owner = 0;
+
spin_lock(&lock->l_spin);
- if (lock->l_owner == current) {
+ if (lock->l_owner == current)
owner = 1;
- }
spin_unlock(&lock->l_spin);
- if (owner)
- ++lock->l_depth;
- else {
+
+ if (owner) {
+ ++lock->l_depth;
+ } else {
down(&lock->l_sem);
spin_lock(&lock->l_spin);
lock->l_owner = current;
void l_unlock(struct lustre_lock *lock)
{
- if (lock->l_owner != current)
- LBUG();
- if (lock->l_depth < 0)
- LBUG();
+ LASSERT(lock->l_owner == current);
+ LASSERT(lock->l_depth >= 0);
- spin_lock(&lock->l_spin);
- if (--lock->l_depth < 0) {
+ spin_lock(&lock->l_spin);
+ if (--lock->l_depth < 0) {
lock->l_owner = NULL;
spin_unlock(&lock->l_spin);
up(&lock->l_sem);
- return ;
+ return;
}
spin_unlock(&lock->l_spin);
}
+
+int l_has_lock(struct lustre_lock *lock)
+{
+ int depth = -1, owner = 0;
+
+ spin_lock(&lock->l_spin);
+ if (lock->l_owner == current) {
+ depth = lock->l_depth;
+ owner = 1;
+ }
+ spin_unlock(&lock->l_spin);
+
+ if (depth >= 0)
+ CDEBUG(D_INFO, "lock_depth: %d\n", depth);
+ return owner;
+}
lock->l_random = DEAD_HANDLE_MAGIC;
if (lock->l_export && lock->l_export->exp_connection)
ptlrpc_put_connection(lock->l_export->exp_connection);
+ memset(lock, 0x5a, sizeof(*lock));
kmem_cache_free(ldlm_lock_slab, lock);
//spin_unlock(&ldlm_handle_lock);
CDEBUG(D_MALLOC, "kfreed 'lock': %d at %p (tot 0).\n",
struct ldlm_lock *lock = NULL, *retval = NULL;
ENTRY;
- if (!handle || !handle->addr)
+ LASSERT(handle);
+
+ if (!handle->addr)
RETURN(NULL);
//spin_lock(&ldlm_handle_lock);
GOTO(out, NULL);
}
- if (flags && (lock->l_flags & flags))
+ if (flags && (lock->l_flags & flags))
GOTO(out, NULL);
if (flags)
ldlm_mode_t mode, void *data, __u32 data_len)
{
struct ldlm_resource *res, *parent_res = NULL;
- struct ldlm_lock *lock, *parent_lock;
+ struct ldlm_lock *lock, *parent_lock = NULL;
- parent_lock = ldlm_handle2lock(parent_lock_handle);
- if (parent_lock)
- parent_res = parent_lock->l_resource;
+ if (parent_lock_handle) {
+ parent_lock = ldlm_handle2lock(parent_lock_handle);
+ if (parent_lock)
+ parent_res = parent_lock->l_resource;
+ }
res = ldlm_resource_get(ns, parent_res, res_id, type, 1);
if (res == NULL)
for (i = 0; i < LDLM_NUM_THREADS; i++) {
char name[32];
- sprintf(name, "ldlm_%02d", i);
+ sprintf(name, "ldlm_cn_%02d", i);
rc = ptlrpc_start_thread(obddev, ldlm->ldlm_cancel_service,
name);
if (rc) {
for (i = 0; i < LDLM_NUM_THREADS; i++) {
char name[32];
- sprintf(name, "ldlm_%02d", i);
+ sprintf(name, "ldlm_cb_%02d", i);
rc = ptlrpc_start_thread(obddev, ldlm->ldlm_cb_service, name);
if (rc) {
CERROR("cannot start LDLM thread #%d: rc %d\n", i, rc);
/* concurrent cancels on the same handle can happen */
lock = __ldlm_handle2lock(lockh, 0, LDLM_FL_CANCELING);
- if (!lock) {
+ if (lock == NULL)
RETURN(0);
- }
if (lock->l_connh) {
LDLM_DEBUG(lock, "client-side cancel");
LDLM_DEBUG(lock, "client-side local cancel handler END");
}
+ lock->l_flags |= LDLM_FL_CANCELING;
+
EXIT;
out:
LDLM_LOCK_PUT(lock);
struct ldlm_ast_work *w;
ENTRY;
- if ((flags & LDLM_FL_REDUCE) &&
- ns->ns_max_unused > ns->ns_nr_unused)
- RETURN(0);
-
res = ldlm_resource_get(ns, NULL, res_id, 0, 0);
if (res == NULL) {
/* This is not a problem. */
w->w_lock = LDLM_LOCK_GET(lock);
list_add(&w->w_list, &list);
- if ((flags & LDLM_FL_REDUCE) &&
- ns->ns_max_unused > ns->ns_nr_unused)
- break;
}
l_unlock(&ns->ns_lock);
{
struct ldlm_namespace *ns = NULL;
struct list_head *bucket;
-
-
+ ENTRY;
OBD_ALLOC(ns, sizeof(*ns));
if (!ns) {
out:
if (ns && ns->ns_hash) {
+ memset(ns->ns_hash, 0x5a, sizeof(*ns->ns_hash) * RES_HASH_SIZE);
vfree(ns->ns_hash);
obd_memory -= sizeof(*ns->ns_hash) * RES_HASH_SIZE;
}
cleanup_resource(res, &res->lr_converting, local_only);
cleanup_resource(res, &res->lr_waiting, local_only);
- /* XXX this is a bit counter-intuitive and should
- * probably be cleaner: don't force cleanup if we're
- * local_only (which is only used by recovery). We
- * probably still have outstanding lock refs which
- * reference these resources. -phil */
+ /* XXX what a mess: don't force cleanup if we're
+ * local_only (which is only used by recovery). In that
+ * case, we probably still have outstanding lock refs
+ * which reference these resources. -phil */
if (!ldlm_resource_put(res) && !local_only) {
CERROR("Resource refcount nonzero (%d) after "
"lock cleanup; forcing cleanup.\n",
ldlm_namespace_cleanup(ns, 0);
+ memset(ns->ns_hash, 0x5a, sizeof(*ns->ns_hash) * RES_HASH_SIZE);
vfree(ns->ns_hash /* , sizeof(*ns->ns_hash) * RES_HASH_SIZE */);
obd_memory -= sizeof(*ns->ns_hash) * RES_HASH_SIZE;
OBD_FREE(ns->ns_name, strlen(ns->ns_name) + 1);
if (memcmp(chk->lr_name, name, sizeof(chk->lr_name)) == 0) {
res = chk;
atomic_inc(&res->lr_refcount);
- EXIT;
- break;
+ l_unlock(&ns->ns_lock);
+ RETURN(res);
}
}
- if (res == NULL && create)
+ if (create)
res = ldlm_resource_add(ns, parent, name, type);
l_unlock(&ns->ns_lock);
list_del(&res->lr_hash);
list_del(&res->lr_childof);
+ memset(res, 0x5a, sizeof(*res));
kmem_cache_free(ldlm_resource_slab, res);
l_unlock(&ns->ns_lock);
if (cli->cl_conn_count > 1)
GOTO(out_sem, rc);
+ if (obd->obd_namespace != NULL)
+ CERROR("already have namespace!\n");
obd->obd_namespace = ldlm_namespace_new(obd->obd_name,
LDLM_NAMESPACE_CLIENT);
if (obd->obd_namespace == NULL)
}
}
-void mds_readdir_pack(struct ptlrpc_request *req, int offset,
+void mds_readdir_pack(struct ptlrpc_request *req, __u64 offset,
obd_id ino, int type)
{
struct mds_body *b;
- b = lustre_msg_buf(req->rq_reqmsg, offset);
+ b = lustre_msg_buf(req->rq_reqmsg, 0);
b->fsuid = HTON__u32(current->fsuid);
b->fsgid = HTON__u32(current->fsgid);
b->capability = HTON__u32(current->cap_effective);
#endif
/* push / pop to root of obd store */
-void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new,
+void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx,
struct obd_ucred *uc)
{
//ASSERT_NOT_KERNEL_CTXT("already in kernel context!\n");
- ASSERT_CTXT_MAGIC(new->magic);
+ ASSERT_CTXT_MAGIC(new_ctx->magic);
OBD_SET_CTXT_MAGIC(save);
+
+ /*
+ CDEBUG(D_INFO, "== push %p->%p == cur fs %p pwd %p (%*s), pwdmnt %p\n",
+ save, current, current->fs, current->fs->pwd,
+ current->fs->pwd->d_name.len, current->fs->pwd->d_name.name,
+ current->fs->pwdmnt);
+ */
+
save->fs = get_fs();
save->pwd = dget(current->fs->pwd);
save->pwdmnt = mntget(current->fs->pwdmnt);
LASSERT(save->pwd);
LASSERT(save->pwdmnt);
- LASSERT(new->pwd);
- LASSERT(new->pwdmnt);
+ LASSERT(new_ctx->pwd);
+ LASSERT(new_ctx->pwdmnt);
+
+ if (uc) {
+ save->fsuid = current->fsuid;
+ save->fsgid = current->fsgid;
+ save->cap = current->cap_effective;
- save->fsuid = current->fsuid;
- save->fsgid = current->fsgid;
- save->cap = current->cap_effective;
- if (uc) {
current->fsuid = uc->ouc_fsuid;
current->fsgid = uc->ouc_fsgid;
current->cap_effective = uc->ouc_cap;
}
- set_fs(new->fs);
- set_fs_pwd(current->fs, new->pwdmnt, new->pwd);
- //if (save->override)
- // cap_lower(current->cap_effective, CAP_DAC_OVERRIDE);
+ set_fs(new_ctx->fs);
+ set_fs_pwd(current->fs, new_ctx->pwdmnt, new_ctx->pwd);
+
+ /*
+ CDEBUG(D_INFO, "== push %p==%p == cur fs %p pwd %p (%*s), pwdmnt %p\n",
+ new_ctx, current, current->fs, current->fs->pwd,
+ current->fs->pwd->d_name.len, current->fs->pwd->d_name.name,
+ current->fs->pwdmnt);
+ */
}
-void pop_ctxt(struct obd_run_ctxt *saved)
+void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx,
+ struct obd_ucred *uc)
{
//printk("pc0");
ASSERT_CTXT_MAGIC(saved->magic);
//printk("pc1");
ASSERT_KERNEL_CTXT("popping non-kernel context!\n");
+
+ /*
+ CDEBUG(D_INFO, " == pop %p==%p == cur %p pwd %p (%*s), pwdmnt %p\n",
+ new_ctx, current, current->fs, current->fs->pwd,
+ current->fs->pwd->d_name.len, current->fs->pwd->d_name.name,
+ current->fs->pwdmnt);
+ */
+
+ LASSERT(current->fs->pwd == new_ctx->pwd);
+ LASSERT(current->fs->pwdmnt == new_ctx->pwdmnt);
+
//printk("pc2");
set_fs(saved->fs);
//printk("pc3\n");
//printk("pc5");
mntput(saved->pwdmnt);
//printk("pc6\n");
- current->fsuid = saved->fsuid;
- current->fsgid = saved->fsgid;
- current->cap_effective = saved->cap;
+ if (uc) {
+ current->fsuid = saved->fsuid;
+ current->fsgid = saved->fsgid;
+ current->cap_effective = saved->cap;
+ }
- // if (saved->override)
- // cap_raise(current->cap_effective, CAP_DAC_OVERRIDE);
+ /*
+ CDEBUG(D_INFO, "== pop %p->%p == cur fs %p pwd %p (%*s), pwdmnt %p\n",
+ saved, current, current->fs, current->fs->pwd,
+ current->fs->pwd->d_name.len, current->fs->pwd->d_name.name,
+ current->fs->pwdmnt);
+ */
}
/* utility to make a file */
CERROR("ldlm_cli_cancel: %d\n", rc);
} else
ldlm_lock_decref(handle, it->it_lock_mode);
+
+ /* intent_release may be called multiple times, and we don't
+ * want to double-decref this lock (see bug 494) */
+ it->it_lock_mode = 0;
}
if (!de->d_it || it->it_op == IT_RELEASED_MAGIC) {
RETURN(0);
}
- if (it == NULL && ll_have_lock(de))
- RETURN(1);
+// if (it == NULL && ll_have_lock(de))
+// RETURN(1);
rc = ll_intent_lock(de->d_parent->d_inode, &de, it, revalidate2_finish);
if (rc < 0) {
LBUG();
}
-static struct page * ext2_get_page(struct inode *dir, unsigned long n)
+static struct page * ll_get_page(struct inode *dir, unsigned long n)
{
struct address_space *mapping = dir->i_mapping;
struct page *page = read_cache_page(mapping, n,
for ( ; n < npages; n++, offset = 0) {
char *kaddr, *limit;
ext2_dirent *de;
- struct page *page = ext2_get_page(inode, n);
+ struct page *page;
+
+ page = ll_get_page(inode, n);
/* size might have been updated by mdc_readpage */
npages = dir_pages(inode);
n = start;
do {
char *kaddr;
- page = ext2_get_page(dir, n);
+ page = ll_get_page(dir, n);
if (!IS_ERR(page)) {
kaddr = page_address(page);
de = (ext2_dirent *) kaddr;
struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
{
- struct page *page = ext2_get_page(dir, 0);
+ struct page *page = ll_get_page(dir, 0);
ext2_dirent *de = NULL;
if (!IS_ERR(page)) {
/* We take care of directory expansion in the same loop */
for (n = 0; n <= npages; n++) {
- page = ext2_get_page(dir, n);
+ page = ll_get_page(dir, n);
err = PTR_ERR(page);
if (IS_ERR(page))
goto out;
for (i = 0; i < npages; i++) {
char *kaddr;
ext2_dirent * de;
- page = ext2_get_page(inode, i);
+ page = ll_get_page(inode, i);
if (IS_ERR(page))
continue;
*
* For everything else, we want to lookup to succeed. */
- /* One additional note: we add an extra reference to
- * the request because we need to keep it around until
- * ll_create gets called. For anything else which
- * results in LL_LOOKUP_POSITIVE, we can do the iget()
+ /* One additional note: if CREATE/MKDIR/etc succeeded,
+ * we add an extra reference to the request because we
+ * need to keep it around until ll_create gets called.
+ * For anything else which results in
+ * LL_LOOKUP_POSITIVE, we can do the iget()
* immediately with the contents of the reply (in the
* intent_finish callback). In the create case,
* however, we need to wait until ll_create_node to do
/* For create ops, we want the lookup to be negative,
* unless the create failed in a way that indicates
* that the file is already there */
- if (it->it_status != -EEXIST) {
+ if (it->it_status == 0)
atomic_inc(&request->rq_refcount);
+ if (it->it_status != -EEXIST)
GOTO(out, flag = LL_LOOKUP_NEGATIVE);
- }
/*
* Fall through to update attibutes: it may already
* have appeared in the namespace of another client
struct inode *inode = dentry->d_inode;
struct ll_inode_info *lli = ll_i2info(inode);
struct ptlrpc_request *request;
+ int op, mode;
char *symname;
int rc;
ENTRY;
- /* we got here from a lookup up to the symlink that we hit */
- if (it->it_lock_mode) {
- struct lustre_handle *handle =
- (struct lustre_handle *)it->it_lock_handle;
- ldlm_lock_decref(handle, it->it_lock_mode);
- it->it_lock_mode = 0;
- memset(handle, 0, sizeof(*handle));
- }
+ op = it->it_op;
+ mode = it->it_mode;
+ ll_intent_release(dentry, it);
down(&lli->lli_open_sem);
+
+ it->it_op = op;
+ it->it_mode = mode;
+
rc = ll_readlink_internal(inode, &request, &symname);
if (rc)
GOTO(out, rc);
*/
submd.lsm_stripe_count = 0;
/* XXX submd is not fully initialized here */
+ *flags = 0;
rc = obd_enqueue(&(lov->tgts[loi->loi_ost_idx].conn), &submd,
parent_lock, type, &sub_ext, sizeof(sub_ext),
mode, flags, cb, data, datalen, &(lockhs[i]));
int rc, size[2] = {sizeof(*body), 0}, bufcount = 1;
ENTRY;
+ /* XXX do we need to make another request here? We just did a getattr
+ * to do the lookup in the first place.
+ */
req = ptlrpc_prep_req(class_conn2cliimp(conn), MDS_GETATTR, 1, size,
NULL);
if (!req)
struct ldlm_request *lockreq;
ENTRY;
- LDLM_DEBUG_NOLOCK("mdsintent %s dir %ld", ldlm_it2str(it->it_op),
- dir->i_ino);
+ LDLM_DEBUG_NOLOCK("mdsintent %s parent dir %ld",
+ ldlm_it2str(it->it_op), dir->i_ino);
if (it->it_op & (IT_MKDIR | IT_CREAT | IT_SYMLINK | IT_MKNOD)) {
switch (it->it_op) {
memcpy(&body->handle, fh, sizeof(body->handle));
if (lmm && lmm_size) {
- CDEBUG(D_INODE, "sending %u bytes MD for ino LPU64\n",
+ CDEBUG(D_INODE, "sending %u bytes MD for ino "LPU64"\n",
lmm_size, ino);
lustre_msg_set_op_flags(req->rq_reqmsg, MDS_OPEN_HAS_EA);
memcpy(lustre_msg_buf(req->rq_reqmsg, 1), lmm, lmm_size);
GOTO(out2, rc);
}
- mds_readdir_pack(req, 0, ino, type);
+ mds_readdir_pack(req, offset, ino, type);
req->rq_replen = lustre_msg_size(1, &size);
rc = ptlrpc_queue_wait(req);
*
* If we do not need an exclusive or write lock on this entry (e.g.
* a read lock for attribute lookup only) then we do not hold the
- * directory on return. It is up to the caller to know what type
- * of lock it is getting, and clean up appropriately.
+ * directory semaphore on return. It is up to the caller to know what
+ * type of lock it is getting, and clean up appropriately.
*/
struct dentry *mds_name2locked_dentry(struct obd_device *obd,
struct dentry *dir, struct vfsmount **mnt,
desc = lustre_msg_buf(req->rq_repmsg, 0);
rc = mds_get_lovdesc(mds, desc);
if (rc) {
- CERROR("mds_get_lovdesc error %d", rc);
req->rq_status = rc;
RETURN(0);
}
l_dput(de);
out_pre_de:
req->rq_status = rc;
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, &uc);
return 0;
}
out:
l_dput(de);
out_pop:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, &uc);
RETURN(rc);
}
if (rc2 && !rc)
rc = rc2;
out_ea:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, &uc);
RETURN(rc);
}
filp_close(file, 0);
out_pop:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, &uc);
out:
req->rq_status = rc;
RETURN(0);
++mds->mds_mount_count;
push_ctxt(&saved, &mds->mds_ctxt, NULL);
rc = mds_update_server_data(mds);
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
return rc;
}
if (rc)
CERROR("last_rcvd file won't close, rc=%d\n", rc);
}
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
unlock_kernel();
mntput(mds->mds_vfsmnt);
/* If the client is about to open a file that doesn't have an MD
* stripe record, it's going to need a write lock. */
- if (it->opc & IT_OPEN &&
- !(lustre_msg_get_op_flags(req->rq_reqmsg)&MDS_OPEN_HAS_EA)){
+ if (it->opc & IT_OPEN && !(mds_rep->valid & OBD_MD_FLEASIZE)) {
LDLM_DEBUG(lock, "open with no EA; returning PW lock");
lock->l_req_mode = LCK_PW;
}
"self", mds_handle, "mds");
if (!mds->mds_service) {
CERROR("failed to start service\n");
- GOTO(err_dec, rc = -EINVAL);
+ GOTO(err_dec, rc = -ENOMEM);
}
for (i = 0; i < MDT_NUM_THREADS; i++) {
#define EXT3_XATTR_INDEX_LUSTRE 5
#define XATTR_LUSTRE_MDS_OBJID "system.lustre_mds_objid"
-#define XATTR_MDS_MO_MAGIC 0xEA0BD047
-
/*
* We don't currently need any additional blocks for rmdir and
* unlink transactions because we are storing the OST oa_id inside
/* This gives us the MD size */
if (lmm == NULL)
- return rc;
+ return (rc == -ENODATA) ? 0 : rc;
if (rc < 0) {
CDEBUG(D_INFO, "error getting EA %s from MDS inode %ld: "
"rc = %d\n", XATTR_LUSTRE_MDS_OBJID, inode->i_ino, rc);
memset(lmm, 0, size);
- return rc;
+ return (rc == -ENODATA) ? 0 : rc;
}
/* This field is byteswapped because it appears in the
EXIT;
return;
}
- if (mds_ext3_set_md(inode, handle, NULL))
+ if (mds_ext3_set_md(inode, handle, NULL, 0))
CERROR("error clearing objid on %ld\n", inode->i_ino);
if (mds_ext3_fs_ops.cl_delete_inode)
struct obd_run_ctxt saved;
loff_t off = MDS_LR_CLIENT + (cl_off * MDS_LR_SIZE);
ssize_t written;
-
+
push_ctxt(&saved, &mds->mds_ctxt, NULL);
written = lustre_fwrite(mds->mds_rcvd_filp,
(char *)med->med_mcd,
sizeof(*med->med_mcd), &off);
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
if (written != sizeof(*med->med_mcd)) {
if (written < 0)
push_ctxt(&saved, &mds->mds_ctxt, NULL);
written = lustre_fwrite(mds->mds_rcvd_filp, (const char *)&zero_mcd,
sizeof zero_mcd, &off);
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
if (written != sizeof zero_mcd) {
CERROR("error zeroing out client %s off %d in %s: %d\n",
CDEBUG(D_INFO, "zeroed out disconnecting client %s at off %d\n",
med->med_mcd->mcd_uuid, med->med_off);
}
-
+
OBD_FREE(med->med_mcd, sizeof(*med->med_mcd));
return 0;
}
mds->mds_rcvd_filp = f;
err_pop:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
return rc;
int tgt_count;
int rc;
int i;
+ ENTRY;
tgt_count = desc->ld_tgt_count;
lov_packdesc(desc);
CERROR("Error closing LOVTGTS file\n");
out:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
RETURN(rc);
}
struct obd_run_ctxt saved;
struct file *f;
int rc;
+ ENTRY;
push_ctxt(&saved, &mds->mds_ctxt, NULL);
f = filp_open("LOVDESC", O_RDONLY, 0644);
- if (!f || IS_ERR(f)) {
+ if (IS_ERR(f)) {
CERROR("Cannot open LOVDESC file\n");
- pop_ctxt(&saved);
- RETURN(-EIO);
+ GOTO(out, rc = PTR_ERR(f));
}
rc = lustre_fread(f, (char *)desc, sizeof(*desc), &f->f_pos);
CERROR("Error closing LOVDESC file\n");
if (rc != sizeof(*desc)) {
- CERROR("Cannot read LOVDESC file\n");
- pop_ctxt(&saved);
- RETURN(-EIO);
- }
- pop_ctxt(&saved);
+ CERROR("Cannot read LOVDESC file: rc = %d\n", rc);
+ GOTO(out, rc = -EIO);
+ } else
+ rc = 0;
+ EXIT;
+out:
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
- RETURN(0);
+ return rc;
}
int mds_get_lovtgts(struct mds_obd *mds, int tgt_count,obd_uuid_t *uuidarray)
if (rc >= 0)
rc = -EIO;
GOTO(out, rc);
- } else
+ } else
rc = 0;
EXIT;
out:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, NULL);
RETURN(rc);
}
mds_pack_inode2fid(&body->fid1, inode);
mds_pack_inode2body(body, inode);
if (S_ISREG(inode->i_mode))
- rc = mds_pack_md(mds, req, offset + 1, body, inode);
+ mds_pack_md(mds, req, offset + 1, body, inode);
/* This isn't an error for RECREATE. */
if (rec->ur_opcode & REINT_REPLAYING) {
case S_IFREG:
/* get OBD EA data first so client can also destroy object */
if ((inode->i_mode & S_IFMT) == S_IFREG && offset)
- rc = mds_pack_md(mds, req, offset + 1, body, inode);
+ mds_pack_md(mds, req, offset + 1, body, inode);
/* no break */
case S_IFLNK:
case S_IFCHR:
mds_pack_inode2fid(&body->fid1, inode);
mds_pack_inode2body(body, inode);
if (S_ISREG(inode->i_mode))
- rc = mds_pack_md(mds, req, 2, body, inode);
+ mds_pack_md(mds, req, 2, body, inode);
}
if (rec->ur_opcode & REINT_REPLAYING) {
/* XXX verify that the link is to the the right file? */
mds_pack_inode2fid(&body->fid1, inode);
mds_pack_inode2body(body, inode);
if (S_ISREG(inode->i_mode))
- rc = mds_pack_md(mds, req, 2, body, inode);
+ mds_pack_md(mds, req, 2, body, inode);
}
}
push_ctxt(&saved, &mds->mds_ctxt, &uc);
rc = reinters[realop] (rec, offset, req);
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &mds->mds_ctxt, &uc);
return rc;
}
+# FIXME: we need to make it clear that obdclass.o depends on
+# lustre_build_version, or 'make -j2' breaks!
DEFS=
MODULE = obdclass
-modulefs_DATA = obdclass.o
+modulefs_DATA = lustre_build_version obdclass.o
EXTRA_PROGRAMS = obdclass
obdclass_SOURCES = debug.c genops.c class_obd.c sysctl.c uuid.c lprocfs_status.c
include $(top_srcdir)/Rules
+lustre_build_version:
+ perl $(top_srcdir)/scripts/version_tag.pl $(top_srcdir) > tmpver
+ diff -u tmpver $(top_builddir)/include/linux/lustre_build_version.h &&\
+ $(RM) tmpver || \
+ mv tmpver $(top_builddir)/include/linux/lustre_build_version.h
#include <linux/smp_lock.h>
#include <linux/lprocfs_status.h>
#include <portals/lib-types.h> /* for PTL_MD_MAX_IOV */
+#include <linux/lustre_build_version.h>
struct semaphore obd_conf_sem; /* serialize configuration commands */
struct obd_device obd_dev[MAX_OBD_DEVICES];
down(&obd_conf_sem);
if (!obd && cmd != OBD_IOC_DEVICE && cmd != TCGETS &&
- cmd != OBD_IOC_LIST &&
+ cmd != OBD_IOC_LIST && cmd != OBD_GET_VERSION &&
cmd != OBD_IOC_NAME2DEV && cmd != OBD_IOC_NEWDEV) {
CERROR("OBD ioctl: No device\n");
GOTO(out, err = -EINVAL);
GOTO(out, err);
}
+ case OBD_GET_VERSION:
+ if (!data->ioc_inlbuf1) {
+ CERROR("No buffer passed in ioctl\n");
+ GOTO(out, err = -EINVAL);
+ }
+
+ if (strlen(BUILD_VERSION) + 1 > data->ioc_inllen1) {
+ CERROR("ioctl buffer too small to hold version\n");
+ GOTO(out, err = -EINVAL);
+ }
+
+ memcpy(data->ioc_bulk, BUILD_VERSION,
+ strlen(BUILD_VERSION) + 1);
+
+ err = copy_to_user((void *)arg, data, len);
+ if (err)
+ err = -EFAULT;
+ GOTO(out, err);
case OBD_IOC_NAME2DEV: {
/* Resolve a device name. This does not change the
obd->obd_flags &= ~OBD_SET_UP;
obd->obd_type->typ_refcnt--;
}
- GOTO(out, err);
+ GOTO(out, err);
}
case OBD_IOC_CONNECT: {
int err;
int i;
- printk(KERN_INFO "OBD class driver v0.9, info@clusterfs.com\n");
+ printk(KERN_INFO "OBD class driver Build Version: " BUILD_VERSION
+ ", info@clusterfs.com\n");
sema_init(&obd_conf_sem, 1);
INIT_LIST_HEAD(&obd_types);
/* Check that we're building against the appropriate version of the Lustre
* kernel patch */
#include <linux/lustre_version.h>
-#if (LUSTRE_KERNEL_VERSION != 2)
+#if (LUSTRE_KERNEL_VERSION != 3)
# error Cannot continue: Your Lustre kernel patch is out of date
#endif
MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
-MODULE_DESCRIPTION("Lustre Class Driver v1.0");
+MODULE_DESCRIPTION("Lustre Class Driver Build Version: " BUILD_VERSION);
MODULE_LICENSE("GPL");
module_init(init_obdclass);
struct obd_export *class_conn2export(struct lustre_handle *conn)
{
struct obd_export *export;
+ ENTRY;
if (!conn) {
CDEBUG(D_CACHE, "looking for null handle\n");
struct echo_client_obd *ec = &obd->u.echo_client;
struct obd_ioctl_data *data = karg;
int rw = OBD_BRW_READ, rc = 0;
+ struct lov_stripe_md *lsm = NULL;
ENTRY;
if (obd == NULL) {
GOTO(out, rc = -EINVAL);
}
+ if (data->ioc_inllen1 == sizeof(*lsm)) {
+ lsm = (struct lov_stripe_md *)data->ioc_inlbuf1;
+ } else if (data->ioc_inllen1 != 0) {
+ CERROR("nonzero ioc_inllen1 != sizeof(struct lov_stripe_md)\n");
+ GOTO(out, rc = -EINVAL);
+ }
+
switch (cmd) {
case OBD_IOC_CREATE: {
- struct lov_stripe_md *lsm = NULL;
-#warning FIXME: save lsm into file handle for other ops, release on close
- rc = obd_create(&ec->conn, &data->ioc_obdo1, &lsm);
+ struct lov_stripe_md *tmp_lsm = NULL;
+ rc = obd_create(&ec->conn, &data->ioc_obdo1, &tmp_lsm);
+ if (lsm)
+ memcpy(lsm, tmp_lsm, sizeof(*tmp_lsm));
+
GOTO(out, rc);
}
case OBD_IOC_GETATTR:
- rc = obd_getattr(&ec->conn, &data->ioc_obdo1, NULL);
+ rc = obd_getattr(&ec->conn, &data->ioc_obdo1, lsm);
GOTO(out, rc);
case OBD_IOC_SETATTR:
- rc = obd_setattr(&ec->conn, &data->ioc_obdo1, NULL);
+ rc = obd_setattr(&ec->conn, &data->ioc_obdo1, lsm);
GOTO(out, rc);
- case OBD_IOC_DESTROY: {
- //void *ea;
- rc = obd_destroy(&ec->conn, &data->ioc_obdo1, NULL);
+ case OBD_IOC_DESTROY:
+ rc = obd_destroy(&ec->conn, &data->ioc_obdo1, lsm);
GOTO(out, rc);
- }
-
- case OBD_IOC_OPEN: {
- struct lov_stripe_md *lsm = NULL; // XXX fill in from create
+ case OBD_IOC_OPEN:
rc = obd_open(&ec->conn, &data->ioc_obdo1, lsm);
GOTO(out, rc);
- }
-
- case OBD_IOC_CLOSE: {
- struct lov_stripe_md *lsm = NULL; // XXX fill in from create
+ case OBD_IOC_CLOSE:
rc = obd_close(&ec->conn, &data->ioc_obdo1, lsm);
GOTO(out, rc);
- }
case OBD_IOC_BRW_WRITE:
rw = OBD_BRW_WRITE;
case OBD_IOC_BRW_READ: {
- struct lov_stripe_md tmp_lsm; // XXX fill in from create
- struct lov_stripe_md *lsm = &tmp_lsm; // XXX fill in from create
+ struct lov_stripe_md tmp_lsm;
struct obd_brw_set *set;
obd_count pages = 0;
struct brw_page *pga, *pgp;
- __u64 id = data->ioc_obdo1.o_id;
+ __u64 off, id = data->ioc_obdo1.o_id;
int gfp_mask = (id & 1) ? GFP_HIGHUSER : GFP_KERNEL;
- int verify = (id != 0);
- __u64 off;
- int j;
+ int j, verify = (id != 0);
+
+ if (lsm && lsm->lsm_object_id != id) {
+ CERROR("LSM object ID ("LPU64") != id ("LPU64")\n",
+ lsm->lsm_object_id, id);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ if (!lsm) {
+ memset(&tmp_lsm, 0, sizeof(tmp_lsm));
+ lsm = &tmp_lsm;
+ lsm->lsm_object_id = id;
+ }
+
+ if (data->ioc_count < 0) {
+ CERROR("invalid buffer size: "LPD64"\n",
+ data->ioc_count);
+ GOTO(out, rc = -EINVAL);
+ }
set = obd_brw_set_new();
if (set == NULL)
GOTO(brw_free, rc = -ENOMEM);
}
- memset(lsm, 0, sizeof(*lsm)); // XXX don't do this later
- lsm->lsm_object_id = id; // ensure id == lsm->lsm_object_id
-
for (j = 0, pgp = pga; j < pages; j++, off += PAGE_SIZE, pgp++){
pgp->pg = alloc_pages(gfp_mask, 0);
if (!pgp->pg) {
rc = 0;
out:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &filter->fo_ctxt, NULL);
return(rc);
}
f_dput(filter->fo_dentry_O);
out:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &filter->fo_ctxt, NULL);
}
/* parent i_sem is already held if needed for exclusivity */
static struct dentry *filter_fid2dentry(struct obd_device *obd,
struct dentry *dparent,
- __u64 id, __u32 type)
+ __u64 id, __u32 type, int locked)
{
struct super_block *sb = obd->u.filter.fo_sb;
struct dentry *dchild;
len = sprintf(name, LPU64, id);
CDEBUG(D_INODE, "opening object O/%s/%s\n", obd_mode_to_type(type),
name);
+ if (!locked)
+ down(&dparent->d_inode->i_sem);
dchild = lookup_one_len(name, dparent, len);
+ if (!locked)
+ up(&dparent->d_inode->i_sem);
if (IS_ERR(dchild)) {
CERROR("child lookup error %ld\n", PTR_ERR(dchild));
RETURN(dchild);
filter_id(name, id, type);
push_ctxt(&saved, &filter->fo_ctxt, NULL);
- file = filp_open(name, O_RDONLY | O_LARGEFILE, 0 /* type? */);
- pop_ctxt(&saved);
+ file = filp_open(name, O_RDWR | O_LARGEFILE, 0 /* type? */);
+ pop_ctxt(&saved, &filter->fo_ctxt, NULL);
- if (IS_ERR(file))
+ if (IS_ERR(file)) {
+ CERROR("error opening %s: rc %d\n", name, PTR_ERR(file));
GOTO(out_fdd, file);
+ }
dentry = file->f_dentry;
spin_lock(&filter->fo_fddlock);
list_add(&ffd->ffd_export_list, &fed->fed_open_head);
spin_unlock(&fed->fed_lock);
- CDEBUG(D_INODE, "opening objid "LPX64": rc = %p\n", id, file);
+ CDEBUG(D_INODE, "opened objid "LPX64": rc = %p\n", id, file);
out:
RETURN(file);
push_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
rc = vfs_unlink(dir_dentry->d_inode, object_dentry);
/* XXX unlink from PENDING directory now too */
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
if (rc)
CERROR("error unlinking objid %*s: rc %d\n",
}
static struct dentry *__filter_oa2dentry(struct lustre_handle *conn,
- struct obdo *oa, char *what)
+ struct obdo *oa, int locked,char *what)
{
struct dentry *dentry = NULL;
RETURN(ERR_PTR(-EINVAL));
}
dentry = filter_fid2dentry(obd, filter_parent(obd, oa->o_mode),
- oa->o_id, oa->o_mode);
+ oa->o_id, oa->o_mode, locked);
}
if (IS_ERR(dentry)) {
return dentry;
}
-#define filter_oa2dentry(conn, oa) __filter_oa2dentry(conn, oa, __FUNCTION__)
+#define filter_oa2dentry(conn, oa, locked) __filter_oa2dentry(conn, oa, locked,\
+ __FUNCTION__)
static int filter_getattr(struct lustre_handle *conn, struct obdo *oa,
struct lov_stripe_md *md)
int rc = 0;
ENTRY;
- dentry = filter_oa2dentry(conn, oa);
+ dentry = filter_oa2dentry(conn, oa, 0);
if (IS_ERR(dentry))
RETURN(PTR_ERR(dentry));
int rc;
ENTRY;
- dentry = filter_oa2dentry(conn, oa);
+ dentry = filter_oa2dentry(conn, oa, 0);
if (IS_ERR(dentry))
RETURN(PTR_ERR(dentry));
rc = inode->i_op->setattr(dentry, &iattr);
else
rc = inode_setattr(inode, &iattr);
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
if (iattr.ia_valid & ATTR_SIZE) {
up(&inode->i_sem);
oa->o_valid = OBD_MD_FLBLOCKS | OBD_MD_FLCTIME | OBD_MD_FLMTIME;
handle->addr = (__u64)(unsigned long)ffd;
handle->cookie = ffd->ffd_servercookie;
oa->o_valid |= OBD_MD_FLHANDLE;
+ EXIT;
out:
- RETURN(rc);
+ return rc;
} /* filter_open */
static int filter_close(struct lustre_handle *conn, struct obdo *oa,
sprintf(name, LPU64, oa->o_id);
push_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
new = simple_mknod(filter_parent(obd, oa->o_mode), name, oa->o_mode);
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
if (IS_ERR(new)) {
CERROR("Error mknod obj %s, err %ld\n", name, PTR_ERR(new));
return -ENOENT;
dir_dentry = filter_parent(obd, oa->o_mode);
down(&dir_dentry->d_inode->i_sem);
- object_dentry = filter_oa2dentry(conn, oa);
+ object_dentry = filter_oa2dentry(conn, oa, 1);
if (IS_ERR(object_dentry))
GOTO(out, rc = -ENOENT);
EXIT;
out:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &export->exp_obd->u.filter.fo_ctxt, NULL);
error = (retval >= 0) ? 0 : retval;
return error;
}
int j;
dentry = filter_fid2dentry(obd, filter_parent(obd, S_IFREG),
- o->ioo_id, S_IFREG);
+ o->ioo_id, S_IFREG, 0);
if (IS_ERR(dentry))
GOTO(out_clean, rc = PTR_ERR(dentry));
inode = dentry->d_inode;
rc = err;
}
out_ctxt:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
RETURN(rc);
out_clean:
while (lnb-- > res) {
}
out_ctxt:
- pop_ctxt(&saved);
+ pop_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL);
RETURN(rc);
}
if (!*lmmp)
RETURN(-ENOMEM);
}
- if (lsm)
+ if (lsm) {
+ LASSERT(lsm->lsm_object_id);
(*lmmp)->lmm_object_id = (lsm->lsm_object_id);
+ }
return lmm_size;
}
}
/* XXX endianness */
- if (lmm)
+ if (lmm) {
(*lsmp)->lsm_object_id = (lmm->lmm_object_id);
+ LASSERT((*lsmp)->lsm_object_id);
+ }
return lsm_size;
}
out_local:
OBD_FREE(local_nb, sizeof(*local_nb) * niocount);
out:
- if (rc) {
- /* It's a lot of work to delay allocating the reply, and a lot
- * less work to just free it here. */
- OBD_FREE(req->rq_repmsg, req->rq_replen);
- req->rq_repmsg = NULL;
+ if (rc)
ptlrpc_error(req->rq_svc, req);
- } else
+ else
ptlrpc_reply(req->rq_svc, req);
RETURN(rc);
}
--- linux-2.4.18-17.8.0-uml-pristine/include/linux/lustre_version.h Wed Dec 31 19:00:00 1969
-+++ linux-2.4.18-17.8.0-uml/include/linux/lustre_version.h Wed Nov 6 02:34:14 2002
++++ linux-2.4.18-17.8.0-uml/include/linux/lustre_version.h Tue Nov 26 07:02:14 2002
@@ -0,0 +1 @@
-+#define LUSTRE_KERNEL_VERSION 2
++#define LUSTRE_KERNEL_VERSION 3
--- linux-2.4.18-17.8.0-uml-pristine/arch/ia64/mm/init.c 2002-10-19 11:44:08.000000000 -0600
+++ linux-2.4.18-17.8.0-uml/arch/ia64/mm/init.c 2002-10-19 11:44:51.000000000 -0600
@@ -37,6 +37,12 @@
+{
+ if (de->d_op && de->d_op->d_intent_release)
+ de->d_op->d_intent_release(de, it);
-+ de->d_it = NULL;
++
+}
+
+
dir = nd->dentry;
down(&dir->d_inode->i_sem);
- dentry = lookup_hash(&nd->last, nd->dentry);
-+ dentry = lookup_hash_it(&nd->last, nd->dentry, NULL);
++ dentry = lookup_hash_it(&nd->last, nd->dentry, it);
putname(nd->last.name);
goto do_last;
}
+--- linux-2.4.18-17.8.0-uml-pristine/include/linux/lustre_version.h Wed Dec 31 19:00:00 1969
++++ linux-2.4.18-17.8.0-uml/include/linux/lustre_version.h Tue Nov 26 07:02:14 2002
+@@ -0,0 +1 @@
++#define LUSTRE_KERNEL_VERSION 3
--- kernel-2.4.18-pristine/arch/ia64/mm/init.c 2002-10-14 13:47:20.000000000 -0600
+++ kernel-2.4.18/arch/ia64/mm/init.c 2002-10-14 14:08:23.000000000 -0600
@@ -37,6 +37,12 @@
+{
+ if (de->d_op && de->d_op->d_intent_release)
+ de->d_op->d_intent_release(de, it);
-+ de->d_it = NULL;
++
+}
+
+
dir = nd->dentry;
down(&dir->d_inode->i_sem);
- dentry = lookup_hash(&nd->last, nd->dentry);
-+ dentry = lookup_hash_it(&nd->last, nd->dentry, NULL);
++ dentry = lookup_hash_it(&nd->last, nd->dentry, it);
putname(nd->last.name);
goto do_last;
}
}
if (req->rq_flags & PTL_RPC_FL_RESEND) {
+ ENTRY;
DEBUG_REQ(D_ERROR, req, "RESEND:");
GOTO(out, rc = 1);
}
if (req->rq_flags & PTL_RPC_FL_ERR) {
+ ENTRY;
DEBUG_REQ(D_ERROR, req, "ABORTED:");
GOTO(out, rc = 1);
}
err = req->rq_repmsg->status;
if (req->rq_repmsg->type == NTOH__u32(PTL_RPC_MSG_ERR)) {
- CERROR("req->rq_repmsg->type == PTL_RPC_MSG_ERR\n");
+ DEBUG_REQ(D_ERROR, req, "type == PTL_RPC_MSG_ERR");
RETURN(err ? err : -EINVAL);
}
- if (err != 0) {
- if (err < 0)
- CDEBUG(D_INFO, "req->rq_repmsg->status is %d\n", err);
- else
- CDEBUG(D_INFO, "req->rq_repmsg->status is %d\n", err);
+ if (err < 0) {
+ DEBUG_REQ(D_ERROR, req, "status is %d", err);
+ } else if (err > 0) {
+ /* XXX: translate this error from net to host */
+ DEBUG_REQ(D_INFO, req, "status is %d", err);
}
RETURN(err);
{
struct list_head *tmp, *saved;
struct ptlrpc_request *req;
+ ENTRY;
+
+ CDEBUG(D_HA, "committing for xid "LPU64", last_committed "LPU64"\n",
+ imp->imp_peer_last_xid, imp->imp_peer_committed_transno);
list_for_each_safe(tmp, saved, &imp->imp_replay_list) {
req = list_entry(tmp, struct ptlrpc_request, rq_list);
imp->imp_peer_last_xid = req->rq_repmsg->last_xid;
imp->imp_peer_committed_transno =
req->rq_repmsg->last_committed;
- spin_unlock(&imp->imp_lock);
ptlrpc_free_committed(imp);
+ spin_unlock(&imp->imp_lock);
}
rc = ptlrpc_check_status(req);
struct ptlrpc_request *req = ev->mem_desc.user_ptr;
ENTRY;
- LASSERT ((ev->mem_desc.options & PTL_MD_IOV) == 0); /* requests always contiguous */
+ /* requests always contiguous */
+ LASSERT((ev->mem_desc.options & PTL_MD_IOV) == 0);
if (ev->type != PTL_EVENT_SENT) {
// XXX make sure we understand all events, including ACK's
{
ENTRY;
- LASSERT ((ev->mem_desc.options & PTL_MD_IOV) == 0); /* replies always contiguous */
+ /* replies always contiguous */
+ LASSERT((ev->mem_desc.options & PTL_MD_IOV) == 0);
if (ev->type == PTL_EVENT_SENT) {
OBD_FREE(ev->mem_desc.start, ev->mem_desc.length);
struct ptlrpc_request *req = ev->mem_desc.user_ptr;
ENTRY;
- LASSERT ((ev->mem_desc.options & PTL_MD_IOV) == 0); /* replies always contiguous */
+ /* replies always contiguous */
+ LASSERT((ev->mem_desc.options & PTL_MD_IOV) == 0);
if (req->rq_xid == 0x5a5a5a5a5a5a5a5a) {
CERROR("Reply received for freed request! Probably a missing "
struct ptlrpc_service *service = rqbd->rqbd_service;
/* requests always contiguous */
- LASSERT ((ev->mem_desc.options & PTL_MD_IOV) == 0);
+ LASSERT((ev->mem_desc.options & PTL_MD_IOV) == 0);
/* we only enable puts */
- LASSERT (ev->type == PTL_EVENT_PUT);
- LASSERT (atomic_read (&service->srv_nrqbds_receiving) > 0);
- LASSERT (atomic_read (&rqbd->rqbd_refcount) > 0);
+ LASSERT(ev->type == PTL_EVENT_PUT);
+ LASSERT(atomic_read(&service->srv_nrqbds_receiving) > 0);
+ LASSERT(atomic_read(&rqbd->rqbd_refcount) > 0);
if (ev->rlength != ev->mlength)
CERROR("Warning: Possibly truncated rpc (%d/%d)\n",
ev->mlength, ev->rlength);
- if (ptl_is_valid_handle (&ev->unlinked_me)) {
+ if (ptl_is_valid_handle(&ev->unlinked_me)) {
/* This is the last request to be received into this
* request buffer. We don't bump the refcount, since the
* thread servicing this event is effectively taking over
* portals' reference.
*/
#warning ev->unlinked_me.nal_idx is not set properly in a callback
- LASSERT (ev->unlinked_me.handle_idx == rqbd->rqbd_me_h.handle_idx);
+ LASSERT(ev->unlinked_me.handle_idx==rqbd->rqbd_me_h.handle_idx);
/* we're off the air */
- if (atomic_dec_and_test (&service->srv_nrqbds_receiving)) {
- CERROR ("All request buffers busy\n");
- /* we'll probably start dropping packets in portals soon */
- }
+ /* we'll probably start dropping packets in portals soon */
+ if (atomic_dec_and_test(&service->srv_nrqbds_receiving))
+ CERROR("All request buffers busy\n");
} else {
/* +1 ref for service thread */
atomic_inc(&rqbd->rqbd_refcount);
(ev->type == PTL_EVENT_SENT) ? "SENT" :
(ev->type == PTL_EVENT_ACK) ? "ACK" : "UNEXPECTED", ev->type);
- LASSERT (ev->type == PTL_EVENT_SENT || ev->type == PTL_EVENT_ACK);
+ LASSERT(ev->type == PTL_EVENT_SENT || ev->type == PTL_EVENT_ACK);
- LASSERT (atomic_read (&desc->bd_source_callback_count) > 0 &&
- atomic_read (&desc->bd_source_callback_count) <= 2);
+ LASSERT(atomic_read(&desc->bd_source_callback_count) > 0 &&
+ atomic_read(&desc->bd_source_callback_count) <= 2);
/* 1 fragment for each page always */
- LASSERT (ev->mem_desc.niov == desc->bd_page_count);
+ LASSERT(ev->mem_desc.niov == desc->bd_page_count);
- if (atomic_dec_and_test (&desc->bd_source_callback_count)) {
+ if (atomic_dec_and_test(&desc->bd_source_callback_count)) {
list_for_each_safe(tmp, next, &desc->bd_page_list) {
bulk = list_entry(tmp, struct ptlrpc_bulk_page,
bp_link);
if (ev->type == PTL_EVENT_PUT) {
/* put with zero offset */
- LASSERT (ev->offset == 0);
+ LASSERT(ev->offset == 0);
/* used iovs */
- LASSERT ((ev->mem_desc.options & PTL_MD_IOV) != 0);
+ LASSERT((ev->mem_desc.options & PTL_MD_IOV) != 0);
/* 1 fragment for each page always */
- LASSERT (ev->mem_desc.niov == desc->bd_page_count);
+ LASSERT(ev->mem_desc.niov == desc->bd_page_count);
list_for_each_safe (tmp, next, &desc->bd_page_list) {
bulk = list_entry(tmp, struct ptlrpc_bulk_page,
bulk->bp_cb(bulk);
}
- LASSERT (ev->mem_desc.length == total);
+ LASSERT(ev->mem_desc.length == total);
desc->bd_flags |= PTL_BULK_FL_RCVD;
wake_up(&desc->bd_waitq);
desc->bd_md.options = PTL_MD_OP_PUT | PTL_MD_IOV;
desc->bd_md.user_ptr = desc;
- atomic_set (&desc->bd_source_callback_count, 2);
+ atomic_set(&desc->bd_source_callback_count, 2);
list_for_each_safe(tmp, next, &desc->bd_page_list) {
struct ptlrpc_bulk_page *bulk;
bulk = list_entry(tmp, struct ptlrpc_bulk_page, bp_link);
- LASSERT (desc->bd_md.niov < desc->bd_page_count);
+ LASSERT(desc->bd_md.niov < desc->bd_page_count);
if (desc->bd_md.niov == 0)
xid = bulk->bp_xid;
- LASSERT (xid == bulk->bp_xid); /* should all be the same */
+ LASSERT(xid == bulk->bp_xid); /* should all be the same */
iov[desc->bd_md.niov].iov_base = bulk->bp_buf;
iov[desc->bd_md.niov].iov_len = bulk->bp_buflen;
desc->bd_md.length += bulk->bp_buflen;
}
- LASSERT (desc->bd_md.niov == desc->bd_page_count);
- LASSERT (desc->bd_md.niov != 0);
+ LASSERT(desc->bd_md.niov == desc->bd_page_count);
+ LASSERT(desc->bd_md.niov != 0);
rc = PtlMDBind(desc->bd_connection->c_peer.peer_ni, desc->bd_md,
&desc->bd_md_h);
struct ptlrpc_bulk_page *bulk;
bulk = list_entry(tmp, struct ptlrpc_bulk_page, bp_link);
- LASSERT (desc->bd_md.niov < desc->bd_page_count);
+ LASSERT(desc->bd_md.niov < desc->bd_page_count);
if (desc->bd_md.niov == 0)
xid = bulk->bp_xid;
- LASSERT (xid == bulk->bp_xid); /* should all be the same */
+ LASSERT(xid == bulk->bp_xid); /* should all be the same */
iov[desc->bd_md.niov].iov_base = bulk->bp_buf;
iov[desc->bd_md.niov].iov_len = bulk->bp_buflen;
desc->bd_md.length += bulk->bp_buflen;
}
- LASSERT (desc->bd_md.niov == desc->bd_page_count);
- LASSERT (desc->bd_md.niov != 0);
+ LASSERT(desc->bd_md.niov == desc->bd_page_count);
+ LASSERT(desc->bd_md.niov != 0);
source_id.nid = desc->bd_connection->c_peer.peer_nid;
source_id.pid = PTL_PID_ANY;
ptl_md_t dummy;
ptl_handle_md_t md_h;
- LASSERT (atomic_read (&rqbd->rqbd_refcount) == 0);
+ LASSERT(atomic_read(&rqbd->rqbd_refcount) == 0);
/* Attach the leading ME on which we build the ring */
rc = PtlMEAttach(service->srv_self.peer_ni, service->srv_req_portal,
dummy.user_ptr = rqbd;
dummy.eventq = service->srv_eq_h;
- atomic_inc (&service->srv_nrqbds_receiving);
- atomic_set (&rqbd->rqbd_refcount, 1); /* 1 ref for portals */
+ atomic_inc(&service->srv_nrqbds_receiving);
+ atomic_set(&rqbd->rqbd_refcount, 1); /* 1 ref for portals */
rc = PtlMDAttach(rqbd->rqbd_me_h, dummy, PTL_UNLINK, &md_h);
if (rc != PTL_OK) {
LBUG();
#warning proper cleanup required
PtlMEUnlink (rqbd->rqbd_me_h);
- atomic_set (&rqbd->rqbd_refcount, 0);
- atomic_dec (&service->srv_nrqbds_receiving);
+ atomic_set(&rqbd->rqbd_refcount, 0);
+ atomic_dec(&service->srv_nrqbds_receiving);
}
}
int lustre_unpack_msg(struct lustre_msg *m, int len)
{
int required_len, i;
+ ENTRY;
required_len = size_round(sizeof(*m));
if (len < required_len)
char *tmp[] = {cli->cl_target_uuid, obd->obd_uuid };
struct ptlrpc_connection *conn = imp->imp_connection;
struct lustre_handle old_hdl;
- struct ptlrpc_request *request;
+ struct ptlrpc_request *request;
struct obd_export *ldlmexp;
int rc;
imp->imp_handle.cookie = request->rq_repmsg->cookie;
GOTO(out_disc, rc = EALREADY);
}
-
+
CERROR("reconnected to %s@%s after partition\n",
cli->cl_target_uuid, conn->c_remote_uuid);
GOTO(out_disc, rc = EALREADY);
/* It might have committed some after we last spoke, so make sure we
* get rid of them now.
*/
- ptlrpc_free_committed(imp);
-
spin_lock(&imp->imp_lock);
+ ptlrpc_free_committed(imp);
+
CDEBUG(D_HA, "import %p from %s has committed "LPD64"\n",
imp, imp->imp_obd->u.cli.cl_target_uuid, committed);
DEBUG_REQ(D_HA, req, "RETAINED: ");
}
- list_for_each_safe(tmp, pos, &imp->imp_replay_list) {
+ list_for_each_safe(tmp, pos, &imp->imp_replay_list) {
req = list_entry(tmp, struct ptlrpc_request, rq_list);
if (req->rq_transno == imp->imp_max_transno &&
LBUG();
}
}
+
RETURN(rc);
}
case PTL_OK:
thread->t_flags |= SVC_EVENT;
GOTO(out, rc = 1);
-
+
case PTL_EQ_EMPTY:
GOTO(out, rc = 0);
-
+
default:
CERROR("BUG: PtlEQGet returned %d\n", rc);
LBUG();
}
CDEBUG(D_RPCTRACE, "Handling RPC pid:xid:nid:opc %d:"
- LPX64":%x:%d\n",
- NTOH__u32(request->rq_reqmsg->status),
+ LPX64":%x:%d\n",
+ NTOH__u32(request->rq_reqmsg->status),
request->rq_xid,
event->initiator.nid,
NTOH__u32(request->rq_reqmsg->opc));
return rc;
}
+/* Don't use daemonize, it removes fs struct from new thread (bug 418) */
+static void ptlrpc_daemonize(void)
+{
+ exit_mm(current);
+
+ current->session = 1;
+ current->pgrp = 1;
+ current->tty = NULL;
+
+ exit_files(current);
+}
+
static int ptlrpc_main(void *arg)
{
struct ptlrpc_svc_data *data = (struct ptlrpc_svc_data *)arg;
ENTRY;
lock_kernel();
- daemonize();
+ ptlrpc_daemonize();
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
sigfillset(¤t->blocked);
recalc_sigpending();
#endif
#ifdef __arch_um__
- sprintf(current->comm, "%s|%d",
- data->name, current->thread.extern_pid);
+ sprintf(current->comm, "%s|%d", data->name,current->thread.extern_pid);
#else
strcpy(current->comm, data->name);
#endif
list_add(&thread->t_link, &svc->srv_threads);
spin_unlock(&svc->srv_lock);
- /* XXX should we really be cloning open file handles here? */
- rc = kernel_thread(ptlrpc_main, (void *) &d,
- CLONE_VM | CLONE_FS | CLONE_FILES);
+ rc = kernel_thread(ptlrpc_main, (void *) &d, CLONE_VM | CLONE_FILES);
if (rc < 0) {
CERROR("cannot start thread\n");
OBD_FREE(thread, sizeof(*thread));
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-EXTRA_DIST = license-status maketags.sh lustre.spec $(initd_SCRIPTS)
+EXTRA_DIST = license-status maketags.sh lustre.spec version_tag.pl $(initd_SCRIPTS)
initddir = $(sysconfdir)/init.d
initd_SCRIPTS = lustre
include $(top_srcdir)/Rules
--- /dev/null
+#!/usr/bin/perl
+# -*- Mode: perl; indent-tabs-mode: nil; cperl-indent-level: 4 -*-
+
+use strict;
+use diagnostics;
+use IO::File;
+use Time::Local;
+
+my $pristine = 1;
+my $kernver;
+
+sub get_tag()
+{
+ my $tag;
+
+ my $tagfile = new IO::File;
+ if (!$tagfile->open("CVS/Tag")) {
+ return "HEAD";
+ } else {
+ my $tmp = <$tagfile>;
+ $tagfile->close();
+
+ $tmp =~ m/T(.*)/;
+ return $1;
+ }
+}
+
+sub get_latest_mtime()
+{
+ my %months=("Jan" => 0, "Feb" => 1, "Mar" => 2, "Apr" => 3, "May" => 4,
+ "Jun" => 5, "Jul" => 6, "Aug" => 7, "Sep" => 8, "Oct" => 9,
+ "Nov" => 10, "Dec" => 11);
+
+ my $last_mtime = 0;
+ my @entries = `find . -name Entries`;
+ my $entry_file;
+ foreach $entry_file (@entries) {
+ chomp($entry_file);
+ my $entry = new IO::File;
+ if (!$entry->open($entry_file)) {
+ die "unable to open $entry_file: $!\n";
+ }
+ my $line;
+ while (defined($line = <$entry>)) {
+ chomp($line);
+ #print "line: $line\n";
+ my ($junk, $file, $version, $date) = split(/\//, $line);
+
+ #print "junk: $junk\nfile: $file\nver: $version\ndate: $date\n";
+ #print "last_mtime: " . localtime($last_mtime) . "\n";
+
+ if ($junk eq "D" ||
+ $file eq "lustre.spec.in" ||
+ $file !~ m/\.(c|h|am|in)$/) {
+ next;
+ }
+
+ my $cur_dir = $entry_file;
+ $cur_dir =~ s/\/CVS\/Entries$//;
+ my @statbuf = stat("$cur_dir/$file");
+ my $mtime = $statbuf[9];
+ my $local_date = gmtime($mtime);
+ if ($local_date ne $date &&
+ $file ne "lustre.spec.in") {
+ #print "$file : " . localtime($mtime) . "\n";
+ $pristine = 0;
+ }
+
+ if ($mtime > $last_mtime) {
+ $last_mtime = $mtime;
+ }
+
+ if ($date) {
+ my @t = split(/ +/, $date);
+ if (int(@t) != 5) {
+ #print "skipping: $date\n";
+ next;
+ }
+ my ($hours, $min, $sec) = split(/:/, $t[3]);
+ my ($mon, $mday, $year) = ($t[1], $t[2], $t[4]);
+ my $secs = 0;
+ $mon = $months{$mon};
+ $secs = timelocal($sec, $min, $hours, $mday, $mon, $year);
+ if ($secs > $last_mtime) {
+ $last_mtime = $secs;
+ }
+ }
+ }
+ $entry->close();
+ }
+ return $last_mtime;
+}
+
+sub get_linuxdir()
+{
+ my $config = new IO::File;
+ my ($line, $dir);
+ if (!$config->open("Makefile")) {
+ die "Run ./configure first\n";
+ }
+ while (defined($line = <$config>)) {
+ chomp($line);
+ if ($line =~ /LINUX = (.*)/) {
+ $dir = $1;
+ last;
+ }
+ }
+ $config->close();
+ my $ver = new IO::File;
+ if (!$ver->open("$dir/include/linux/version.h")) {
+ die "Run make dep on $dir\n";
+ }
+ while(defined($line = <$ver>)) {
+ $line =~ /\#define UTS_RELEASE "(.*)"/;
+ if ($1) {
+ $kernver = $1;
+ last;
+ }
+ }
+ $ver->close();
+ chomp($kernver);
+ $dir =~ s/\//\./g;
+ return $dir;
+}
+
+sub generate_ver($$$)
+{
+ my $tag = shift;
+ my $mtime = shift;
+ my $linuxdir = shift;
+
+ #print "localtime: " . localtime($mtime) . "\n";
+
+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
+ localtime($mtime);
+ $year += 1900;
+ $mon++;
+ my $show_last = $year . $mon . $mday . $hour . $min . $sec;
+
+ print "#define BUILD_VERSION \"";
+ if ($pristine) {
+ print "$tag-$show_last-PRISTINE-$linuxdir-$kernver\"\n";
+ } else {
+ print "$tag-$show_last-CHANGED-$linuxdir-$kernver\"\n";
+ }
+}
+
+if ($ARGV[0]) {
+ chdir($ARGV[0]);
+}
+my $linuxdir = get_linuxdir();
+my $tag = get_tag();
+my $mtime = get_latest_mtime();
+generate_ver($tag, $mtime, $linuxdir);
+
+exit(0);
common.sh lustre.cfg \
client-echo.cfg elan-server.cfg net-client.cfg obdecho.cfg \
client-mount.cfg ldlm.cfg net-local.cfg obdfilter.cfg \
- client-mount2.cfg lustre.cfg net-server.cfg sanity.sh \
+ client-mount2.cfg lustre.cfg net-server.cfg sanity.sh \
rundbench \
elan-client.cfg mds.cfg trivial.sh
pkgexampledir = '${exec_prefix}/usr/lib/$(PACKAGE)/examples'
runtests runvmstat snaprun.sh tbox.sh common.sh
noinst_PROGRAMS = openunlink testreq truncate directio openme writeme mcreate
noinst_PROGRAMS += munlink tchmod toexcl fsx test_brw openclose createdestroy
-noinst_PROGRAMS += lovstripe stat createmany mkdirmany # ldaptest
+noinst_PROGRAMS += lovstripe stat createmany mkdirmany setuid # ldaptest
# ldaptest_SOURCES = ldaptest.c
tchmod_SOURCES = tchmod.c
stat_SOURCES = stat.c
createmany_SOURCES = createmany.c
mkdirmany_SOURCES = mkdirmany.c
+setuid_SOURCES = setuid.c
include $(top_srcdir)/Rules
# the CVS HEAD are allowed.
set -vxe
-if [ "$LOCAL" != no ]; then
- export NAME=${LOCAL:-local}
- sh ${NAME}.sh
- [ "$RUNTESTS" != "no" ] && sh runtests --reformat ${NAME}.xml
+[ "$CONFIGS" ] || CONFIGS="local lov"
+[ "$THREADS" ] || THREADS=1
+[ "$SIZE" ] || SIZE=20480
+[ "$RSIZE" ] || RSIZE=64
+[ "$UID" ] || UID=1000
+[ "$MNT" ] || MNT=/mnt/lustre
+[ "$COUNT" ] || COUNT=1000
+[ "$DEBUG_OFF" ] || DEBUG_OFF="eval echo 0 > /proc/sys/portals/debug"
- mount | grep lustre_lite || sh llmount.sh
- [ "$SANITY" != "no" ] && sh sanity.sh
- [ "$DBENCH" != "no" ] && sh rundbench 1
- [ "$BONNIE" != "no" ] && bonnie++ -s 0 -n 10 -u 0 -d /mnt/lustre
- sync; sync
- sh llmountcleanup.sh
-fi
+for NAME in $CONFIGS; do
+ export NAME
+ [ -e $NAME.sh ] && sh $NAME.sh
+ [ ! -e $NAME.xml ] && echo "no config '$NAME.xml'" 1>&2 && exit 1
+
+ if [ "$RUNTESTS" != "no" ]; then
+ sh runtests
+ fi
-if [ "$LOV" != no ]; then
- export NAME=${LOV:-lov}
- sh ${NAME}.sh
- [ "$RUNTESTS" != "no" ] && sh runtests --reformat ${NAME}.xml
- mount | grep lustre_lite || sh llmount.sh
+ mount | grep $MNT || sh llmount.sh
[ "$SANITY" != "no" ] && sh sanity.sh
- [ "$DBENCH" != "no" ] && sh rundbench 1
- [ "$BONNIE" != "no" ] && bonnie++ -s 0 -n 10 -u 0 -d /mnt/lustre
- sync; sync
- sh llmountcleanup.sh
-fi
+ if [ "$DBENCH" != "no" ]; then
+ $DEBUG_OFF
+ sh rundbench 1
+ sh llmountcleanup.sh
+ sh llrmount.sh
+ if [ $THREADS -gt 1 ]; then
+ sh rundbench $THREADS
+ sh llmountcleanup.sh
+ sh llrmount.sh
+ fi
+ rm -f /mnt/lustre/client.txt
+ fi
+ chown $UID $MNT && chmod 700 $MNT
+ if [ "$BONNIE" != "no" ]; then
+ $DEBUG_OFF
+ bonnie++ -s 0 -n 10 -u $UID -d $MNT
+ sh llmountcleanup.sh
+ sh llrmount.sh
+ fi
+ IOZONE_OPTS="-i 0 -i 1 -i 2 -+d -r $RSIZE -s $SIZE"
+ IOZONE_FILE="-f $MNT/iozone"
+ if [ "$IOZONE" != "no" ]; then
+ $DEBUG_OFF
+ iozone $IOZONE_OPTS $IOZONE_FILE
+ sh llmountcleanup.sh
+ sh llrmount.sh
+ fi
+ if [ "$IOZONE_DIR" != "no" ]; then
+ $DEBUG_OFF
+ iozone -I $IOZONE_OPTS $IOZONE_FILE.odir
+ IOZVER=`iozone -v | awk '/Revision:/ { print $3 }' | tr -d '.'`
+ sh llmountcleanup.sh
+ sh llrmount.sh
+ if [ "$THREADS" -gt 1 -a "$IOZVER" -ge 3145 ]; then
+ $DEBUG_OFF
+ THREAD=1
+ IOZONE_FILE="-F "
+ SIZE=`expr $SIZE / $THREADS`
+ while [ $THREAD -le $THREADS ]; do
+ IOZONE_FILE="$IOZONE_FILE $MNT/iozone.$THREAD"
+ THREAD=`expr $THREAD + 1`
+ done
+ iozone -I $IOZONE_OPTS -t $THREADS $IOZONE_FILE
+ sh llmountcleanup.sh
+ sh llrmount.sh
+ elif [ $IOZONEVER -lt 3145 ]; then
+ VER=`iozone -v | awk '/Revision:/ { print $3 }'`
+ echo "iozone $VER too old for multi-threaded tests"
+ fi
+ fi
+ if [ "$FSX" != "no" ]; then
+ $DEBUG_OFF
+ ./fsx -c 50 -p 1000 -l 1024000 -N $(($COUNT * 100)) $MNT/fsxfile
+ sh llmountcleanup.sh
+ #sh llrmount.sh
+ fi
+ mount | grep $MNT && sh llmountcleanup.sh
+done
LMC="save_cmd"
LMC_REAL="../../lustre/utils/lmc -m $config"
-PORT=988
TCPBUF=1048576
OST=ba-ost-1
CLIENT=client
[ -f $config ] && rm $config
# Client node
-${LMC} --node $CLIENT --tcpbuf $TCPBUF --net '*' tcp $PORT
+${LMC} --node $CLIENT --tcpbuf $TCPBUF --net '*' tcp
OBD_UUID=`awk "/$OST / { print \\$3 }" $UUIDLIST`
[ "$OBD_UUID" ] && OBD_UUID="--obduuid=$OBD_UUID" || echo "$OST: no UUID"
# server node
-${LMC} --node $OST --tcpbuf $TCPBUF --net $OST tcp $PORT
+${LMC} --node $OST --tcpbuf $TCPBUF --net $OST tcp
${LMC} --node $OST --obdtype=obdecho $OBD_UUID --ost
# osc on client
LMC="save_cmd"
TCPBUF=1048576
-OST=ba-ost-1
+OST=${OST:-ba-ost-1}
MDS=`hostname`
UUIDLIST=${UUIDLIST:-/usr/local/admin/ba-ost/UUID.txt}
#!/usr/bin/perl
+use Getopt::Long;
+
+GetOptions("silent!"=> \$silent);
my $mtpt = shift || usage();
my $mount_count = shift || usage();
my $i = shift || usage();
my $files = 5;
-my $mcreate = 1; # should we use mcreate or open?
+my $mcreate = 0; # should we use mcreate or open?
sub usage () {
print "Usage: $0 <mount point prefix> <mount count> <iterations>\n";
if ($mcreate) {
my $tmp = `./mcreate $path`;
if ($tmp) {
- print "Creating [" . $$."]...\n";
+ print "Creating $path [" . $$."]...\n" if !$silent;
$tmp =~ /.*error: (.*)\n/;
- print "Create done [$$] $path: $!\n";
+ print "Create done [$$] $path: $!\n" if !$silent;
} else {
- print "Create done [$$] $path: Success\n";
+ print "Create done [$$] $path: Success\n"if !$silent;
}
} else {
- print "Opening [" . $$."]...\n";
+ print "Opening $path [" . $$."]...\n"if !$silent;
open(FH, ">$path") || die "open($PATH): $!";
- print "Open done [$$] $path: Success\n";
+ print "Open done [$$] $path: Success\n"if !$silent;
close(FH) || die;
}
}
}
$d = int(rand() * $files);
$path = "$mtpt$which/$d";
- print "Unlink start [" . $$."]...\n";
+ print "Unlink $path start [" . $$."]...\n"if !$silent;
if (unlink($path)) {
- print "Unlink done [$$] $path: Success\n";
+ print "Unlink done [$$] $path: Success\n"if !$silent;
} else {
- print "Unlink done [$$] $path: $!\n";
+ print "Unlink done [$$] $path: $!\n"if !$silent;
}
}
print "Done.\n";
while ($line = <>) {
$debug_line++;
my ($file, $func, $lno, $name, $size, $addr, $type);
- if ($line =~ m/^.*\((.*):(.*)\,l\. (\d+) .* k(.*) '(.*)': (\d+) at (.*) \(tot .*$/) {
+ if ($line =~ m/^.*\((.*):(\d+):(.*)\(\) \d+\+\d+\): [vk](.*) '(.*)': (\d+) at (.*) \(tot .*$/) {
$file = $1;
- $func = $2;
- $lno = $3;
+ $lno = $2;
+ $func = $3;
$type = $4;
$name = $5;
$size = $6;
SERVER=localhost
CLIENT=localhost
+# FIXME: make LMC not require MDS for obdecho LOV
+MDSDEV=$TMP/mds1
+MDSSIZE=10000
+
+STRIPE_BYTES=65536
+STRIPES_PER_OBJ=2 # 0 means stripe over all OSTs
+
+LOV=0
+while [ "$1" ]; do
+ case $1 in
+ --lov) LOV="1" ;;
+ *) OPTS="$OPTS $1" ;;
+ esac
+ shift
+done
+
# create nodes
$LMC -o $config --node $SERVER --net $SERVER tcp || exit 1
-$LMC -m $config --node $SERVER --obdtype=obdecho --ost || exit 2
-# force the osc to be configured (this is normally done when it is mounted)
-$LMC -m $config --node $CLIENT --osc OSC_$SERVER || exit 3
-$LMC -m $config --node $CLIENT --echo_client OSC_${SERVER} || exit 3
+if (($LOV)); then
+ $LMC -m $config --node $SERVER --mds mds1 $MDSDEV $MDSSIZE || exit 10
+ $LMC -m $config --lov lov1 mds1 $STRIPE_BYTES $STRIPES_PER_OBJ 0 || exit 11
+ $LMC -m $config --node $SERVER --lov lov1 --obdtype=obdecho --ost || exit 12
+ $LMC -m $config --node $SERVER --lov lov1 --obdtype=obdecho --ost || exit 13
+
+ $LMC -m $config --node $CLIENT --echo_client lov1 || exit 3
+else
+ $LMC -m $config --node $SERVER --obdtype=obdecho --ost || exit 2
+ # force the osc to be configured (this is normally done when it is mounted)
+ $LMC -m $config --node $CLIENT --osc OSC_$SERVER || exit 3
+ $LMC -m $config --node $CLIENT --echo_client OSC_${SERVER} || exit 3
+fi
-$LCONF --gdb $config || exit 4
+$LCONF --gdb $OPTS $config || exit 4
cat <<EOF
run getattr tests as:
-../utils/lctl --device \$ECHO_$SERVER test_getattr 1000000
+../utils/lctl --device '\$ECHO_$SERVER' test_getattr 1000000
EOF
-
fi
${LCONF} --reformat --gdb $config || exit 2
-
--- /dev/null
+#!/bin/sh
+# suggested boilerplate for test script
+
+LCONF=${LCONF:-../utils/lconf}
+NAME=${NAME:-local2}
+
+config=$NAME.xml
+mkconfig=./$NAME.sh
+
+if [ ! -f $config -o $mkconfig -nt $config ]; then
+ sh $mkconfig $config || exit 1
+fi
+
+${LCONF} -v --reformat --gdb $config || exit 2
+
+../utils/lctl <<EOF
+newdev
+attach osc OSC2_localhost OSC2_localhost_UUID
+setup OBD_localhost_UUID NET_localhost_tcp_UUID
+newdev
+attach mdc MDC2_mds1 MDC2_uuid
+setup mds1_UUID NET_localhost_tcp_UUID
+quit
+EOF
+
+mount -t lustre_lite -o osc=OSC2_localhost_UUID,mdc=MDC2_uuid none /mnt/lustre2
LCONF=${LCONF:-../utils/lconf}
NAME=${NAME:-local}
+TMP=${TMP:-/tmp}
config=$NAME.xml
mkconfig=./$NAME.sh
-if [ ! -f $config -o $mkconfig -nt $config ]; then
+if [ ! -f $config ]; then
sh $mkconfig $config || exit 1
fi
-${LCONF} --cleanup --dump /tmp/debug $config
-
+sync; sleep 2; sync
+${LCONF} --cleanup --dump $TMP/debug $config
+LEAK=`dmesg | grep -v " 0 bytes" | grep leaked`
+if [ "$LEAK" ]; then
+ echo "$LEAK" 1>&2
+ mv $TMP/debug $TMP/debug.`date +%s`
+ #exit -1
+fi
+BUSY=`dmesg | grep -i destruct`
+if [ "$BUSY" ]; then
+ echo "$BUSY" 1>&2
+ #exit -2
+fi
--- /dev/null
+#!/bin/sh
+
+umount /mnt/lustre2
+umount /mnt/lustre1
+../utils/lctl <<EOF
+name2dev OSC2_localhost
+cleanup
+detach
+name2dev MDC2_mds1
+cleanup
+detach
+quit
+EOF
+
+LCONF=${LCONF:-../utils/lconf}
+NAME=${NAME:-local}
+
+config=$NAME.xml
+mkconfig=./$NAME.sh
+
+if [ ! -f $config -o $mkconfig -nt $config ]; then
+ sh $mkconfig $config || exit 1
+fi
+
+${LCONF} --cleanup --dump /tmp/debug $config
config=${1:-lov.xml}
-LMC=../utils/lmc
+LMC=${LMC:-../utils/lmc}
TMP=${TMP:-/tmp}
MDSDEV=$TMP/mds1
#!/bin/bash
-config=${1:-mcr2.xml}
+BASE=`hostname | sed "s/[i0-9]*$//"`
+[ $BASE = "mcr" ] && OSTBASE=${OSTBASE:-ba} || OSTBASE=${OSTBASE:-ba-ost-}
+
+config=${1:-$BASE.xml}
+
+BATCH=/tmp/lmc-batch.$$
+save_cmd() {
+ echo "$@" >> $BATCH
+}
LMC="save_cmd"
LMC_REAL="../../lustre/utils/lmc -m $config"
# TCP/IP servers
-SERVER_START=1
-SERVER_CNT=62
-GW_START=1
-GW_CNT=31
-MDS=mcr23
-UUIDLIST=${UUIDLIST:-/home/bluearc/UUID.0920}
+SERVER_START=0
+SERVER_CNT=64
+GW_START=0
+GW_CNT=32
+MDS=${BASE}23
+UUIDLIST=${UUIDLIST:-/usr/local/admin/ba-ost/UUID.txt}
+
+echo "MDS: $MDS"
-# THis is needed for to create route for elan network
-CLIENT_LO=mcr40
-CLIENT_HI=mcr96
+# This is needed for to create route for elan network
+CLIENT_LO=36
+CLIENT_HI=155
TCPBUF=1048576
-
h2elan () {
echo $1 | sed 's/[^0-9]*//g'
}
h2ip () {
echo "${1}"
}
-# map gwNN to mcrNN
-# assumes /etc/hosts looks like this:
-# 192.168.40.11 emcr10 mcr10-eth0 emcr-r2-s1 gw10
-gw2mcr() {
- awk '$5 = /'$1'$/ {print substr($2,2)}' /etc/hosts
-}
-BATCH=/tmp/lmc-batch.$$
-save_cmd() {
- echo "$@" >> $BATCH
+
+# map gateway NN to host NN (assumes mcr[22-25] are not gateways)
+gw2node() {
+ [ $1 -gt 21 ] && echo $(($1 + 4)) || echo $1
}
[ -f $config ] && rm $config
${LMC} --node $MDS --net `h2elan $MDS` elan || exit 1
${LMC} --node $MDS --mds mds1 /tmp/mds1 100000 || exit 1
-${LMC} --lov lov1 mds1 65536 0 0
+${LMC} --lov lov1 mds1 65536 1 0
# Client node
#${LMC} --node client --tcpbuf $TCPBUF --net '*' tcp || exit 1
# this is crude, but effective
let server_per_gw=($SERVER_CNT / $GW_CNT )
let tot_server=$server_per_gw*$GW_CNT
-echo "Allocating $server_per_gw per gateway."
-echo "For a total of $tot_server Blue Arcs"
+echo "Allocating $server_per_gw OSTs per gateway."
+echo "For a total of $tot_server Blue Arc OSTs"
let gw=$GW_START
let server=$SERVER_START
while (( $gw < $GW_CNT + GW_START ));
do
- echo "gw$gw"
- gwnode=`gw2mcr gw$gw`
+ gwnode=$BASE`gw2node $gw`
+ echo "Router: $gwnode"
${LMC} --router --node $gwnode --tcpbuf $TCPBUF --net `h2ip $gwnode` tcp || exit 1
${LMC} --node $gwnode --net `h2elan $gwnode` elan|| exit 1
${LMC} --node $gwnode --route elan `h2elan $gwnode` `h2elan $CLIENT_LO` `h2elan $CLIENT_HI` || exit 2
let i=0
while (( $i < $server_per_gw ));
do
- echo "server: $server"
- OST=ba$server
+ OST=${OSTBASE}$server
+ echo "server: $OST"
OBD_UUID=`awk "/$OST / { print \\$3 }" $UUIDLIST`
[ "$OBD_UUID" ] && OBD_UUID="--obduuid=$OBD_UUID" || echo "$OST: no UUID"
# server node
#!/bin/sh
-[ -e /proc/sys/portals/debug ] && echo 0 > /proc/sys/portals/debug
-if [ ! -e client.txt ]; then
- if [ -e /usr/lib/dbench/client.txt ]; then
- cp /usr/lib/dbench/client.txt /mnt/lustre/client.txt
- elif [ -e /usr/lib/dbench/client_plain.txt ]; then
- cp /usr/lib/dbench/client_plain.txt /mnt/lustre/client.txt
- fi
-fi
+#[ -e /proc/sys/portals/debug ] && echo 0 > /proc/sys/portals/debug
+TGT=/mnt/lustre/client.txt
+SRC=/usr/lib/dbench/client.txt
+[ ! -e $TGT -a -e $SRC ] && echo "copying $SRC to $TGT" && cp $SRC $TGT
+SRC=/usr/lib/dbench/client_plain.txt
+[ ! -e $TGT -a -e $SRC ] && echo "copying $SRC to $TGT" && cp $SRC $TGT
cd /mnt/lustre
dbench -c client.txt $@
#!/bin/sh
-SIZE=5g
-COUNT=0
+[ -z "$SIZE" ] && SIZE=5g
+[ -z "$LOOPS" ] && LOOPS=9999
[ -z "$VERIFY" ] && VERIFY="-+d"
[ -z "$ODIR" ] && ODIR="-I"
[ -z "$REC" ] && REC=64
-FILE=/mnt/lustre/test.$$
+[ -z "$FILE" ] && FILE=/mnt/lustre/test.$$
[ $1 ] && SIZE=$1
+COUNT=0
rm -f endiozone
echo 0 > /proc/sys/portals/debug
while date; do
echo "Test #$COUNT"
iozone $VERIFY $ODIR -r $REC -i 0 -i 1 -f $FILE -s $SIZE 2>&1 || exit $?
COUNT=`expr $COUNT + 1`
- [ -f endiozone ] && rm endiozone && exit 0
+ [ -f endiozone -o $COUNT -ge $LOOPS ] && rm -f endiozone && exit 0
done | tee /tmp/iozone.log
SRCDIR="`dirname $0`/"
. $SRCDIR/common.sh
-COUNT=${COUNT:-10000000}
+COUNT=${COUNT:-1000000}
COUNT_10=`expr $COUNT / 10`
COUNT_100=`expr $COUNT / 100`
DO=test_brw
RW=w
;;
-
test_brw_read)
DO=test_brw
RW=r
SRCDIR="`dirname $0`/"
. $SRCDIR/common.sh
-COUNT=${COUNT:-10000000}
+COUNT=${COUNT:-1000000}
COUNT_10=`expr $COUNT / 10`
COUNT_100=`expr $COUNT / 100`
COUNT_1000=`expr $COUNT / 1000`
case $DO in
test_getattr)
RW=
+ ;;
test_brw_write)
DO=test_brw
PG=1
PGV=16
;;
-
test_brw_read)
PG=1
- case $OSTNODE in
- ba*) PGV= ;; # disabled until the BA OST code is updated
- *) PGV=16 ;;
- esac
+ PGV=16
;;
esac
runthreads 1 $CMD $COUNT -30 $PG
[ "$PGV" ] && runthreads 1 $CMD $COUNT_10 -30 $PGV
- runthreads 1 $CMD 100 -10 $PG
-
runthreads 2 $CMD $COUNT_100 -30 $PG
[ "$PGV" ] && runthreads 2 $CMD $COUNT_1000 -30 $PGV
export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
-cleanup() {
- sync
- $LCONF --cleanup --dump /tmp/debug $OPTS
- sync
- #trap 0
-}
-
ERROR=
SRC=/etc
[ "$COUNT" ] || COUNT=1000
[ "$MCREATE" ] || MCREATE=$SRCDIR/../tests/mcreate
+while [ "$1" ]; do
+ case $1 in
+ *.xml) export NAME=`echo $1 | sed "s/.xml//"` ;;
+ esac
+ shift
+done
+
OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
if [ -z "$OSCMT" ]; then
- [ -z "$*" ] && fail "usage: $0 [--reformat] <conf>.xml" 1
- $LCONF --gdb $@ || exit 1
- #trap cleanup 0
+ sh llmount.sh
OSCMT="`mount | awk '/ lustre_lite / { print $3 }' | tail -1`"
[ -z "$OSCMT" ] && fail "no lustre filesystem mounted" 1
I_MOUNTED="yes"
fi
-while [ "$1" ]; do
- case $1 in
- -v|--verbose) V=-v;;
- --reformat) : ;;
- *) OPTS="$OPTS $1" ;;
- esac
- shift
-done
-
OSCTMP=`echo $OSCMT | tr "/" "."`
USED=`df | awk "/$OSCTMP/ { print \\$3 }" | tail -1`
USED=`expr $USED + 16` # Some space for the status file
HOSTS=$OSCMT/hosts.$$
# this will cause the following cp to trigger bug #620096
-#echo "create an empty file $HOSTS"
-#$MCREATE $HOSTS
+echo "create an empty file $HOSTS"
+$MCREATE $HOSTS
echo "copying /etc/hosts to $HOSTS"
cp /etc/hosts $HOSTS || fail "can't cp /etc/hosts to $HOSTS" 3
echo "creating $DST"
mkdir $DST || fail "can't mkdir $DST" 10
-# ok, that hopefully worked, so let's do a little more
-FILES=`find $SRC -type f | grep -v mtab | head -$COUNT`
+# ok, that hopefully worked, so let's do a little more, with files that
+# haven't changed in the last day (hopefully they don't change during test)
+FILES=`find $SRC -type f -mtime +1 -ctime +1 | head -$COUNT`
echo "copying files from $SRC to $DST$SRC"
tar cf - $FILES | tar xvf - -C $DST || fail "copying $SRC" 11
[ "$ERROR" ] && fail "old and new files are different" $ERROR
-cleanup || exit 19
-$LCONF $OPTS || exit 20
+sh llmountcleanup.sh || exit 19
+sh llrmount.sh || exit 20
echo "comparing previously copied files"
for f in $FILES; do
[ "$ERROR" ] && fail "old and new files are different on second diff" $ERROR
-cleanup || exit 29
-$LCONF $OPTS || exit 30
+sh llmountcleanup.sh || exit 19
+sh llrmount.sh || exit 20
echo "renaming $HOSTS.ren to $HOSTS"
mv $HOSTS.ren $HOSTS || fail "can't rename $HOSTS.ren to $HOSTS" 32
echo "This is normal on BA OSTs, because of subdirectories." 1>&2
fi
-[ "$I_MOUNTED" = "yes" ] && cleanup $OPTS || exit 29
+if [ "$I_MOUNTED" = "yes" ]; then
+ sh llmountcleanup.sh || exit 29
+fi
clean() {
echo -n "cleanup..."
sh llmountcleanup.sh > /dev/null
- dmesg | grep leaked | grep -v " 0 bytes"
- dmesg | grep -i destruct
}
CLEAN=clean
start() {
echo -n "mounting..."
sh llrmount.sh > /dev/null
echo -n "mounted"
- echo 0 > /proc/sys/portals/debug
}
START=start
-echo '== touch .../f ; rm .../f ========== test 0'
+echo '== touch .../f ; rm .../f ======================== test 0'
touch /mnt/lustre/f
rm /mnt/lustre/f
$CLEAN
$START
-echo '== mkdir .../d1; mkdir .../d1/d2 == test 1'
+echo '== mkdir .../d1; mkdir .../d1/d2 ================= test 1'
mkdir /mnt/lustre/d1
mkdir /mnt/lustre/d1/d2
$CLEAN
$START
-echo '== mkdir .../d1; touch .../d1/f === test 2'
+echo '== rmdir .../d1/d2; rmdir .../d1 ================= test 1b'
+rmdir /mnt/lustre/d1/d2
+rmdir /mnt/lustre/d1
+$CLEAN
+$START
+
+echo '== mkdir .../d2; touch .../d2/f ================== test 2'
mkdir /mnt/lustre/d2
touch /mnt/lustre/d2/f
$CLEAN
$START
-echo '== mkdir .../d3 =================== test 3'
+echo '== rm -r .../d2; touch .../d2/f ================== test 2b'
+rm -r /mnt/lustre/d2
+$CLEAN
+$START
+
+echo '== mkdir .../d3 ================================== test 3'
mkdir /mnt/lustre/d3
$CLEAN
$START
-echo '== touch .../d3/f ================= test 3b'
+echo '== touch .../d3/f ================================ test 3b'
touch /mnt/lustre/d3/f
$CLEAN
$START
+echo '== rm -r .../d3 ================================== test 3c'
+rm -r /mnt/lustre/d3
+$CLEAN
+$START
-echo '== mkdir .../d4 =================== test 4'
+echo '== mkdir .../d4 ================================== test 4'
mkdir /mnt/lustre/d4
$CLEAN
$START
-echo '== mkdir .../d4/d2 ================ test 4b'
+echo '== mkdir .../d4/d2 =============================== test 4b'
mkdir /mnt/lustre/d4/d2
$CLEAN
$START
-echo '== mkdir .../d5; mkdir .../d5/d2; chmod .../d5/d2 == test 5'
+echo '== mkdir .../d5; mkdir .../d5/d2; chmod .../d5/d2 = test 5'
mkdir /mnt/lustre/d5
mkdir /mnt/lustre/d5/d2
chmod 0666 /mnt/lustre/d5/d2
$CLEAN
$START
-echo '== touch .../f6; chmod .../f6 ===== test 6'
+echo '== touch .../f6; chmod .../f6 ==================== test 6'
touch /mnt/lustre/f6
chmod 0666 /mnt/lustre/f6
$CLEAN
$START
-echo '== mkdir .../d7; mcreate .../d7/f; chmod .../d7/f == test 7'
+echo '== mkdir .../d7; mcreate .../d7/f; chmod .../d7/f = test 7'
mkdir /mnt/lustre/d7
./mcreate /mnt/lustre/d7/f
chmod 0666 /mnt/lustre/d7/f
$START
-echo '=============================== test 10'
+echo '== mkdir .../d10; mkdir .../d10/d2; touch .../d10/d2/f = test 10'
mkdir /mnt/lustre/d10
mkdir /mnt/lustre/d10/d2
touch /mnt/lustre/d10/d2/f
$CLEAN
$START
-echo '=============================== test 11'
+echo '=================================================== test 11'
mkdir /mnt/lustre/d11
mkdir /mnt/lustre/d11/d2
chmod 0666 /mnt/lustre/d11/d2
$CLEAN
$START
-echo '=============================== test 12'
+echo '=================================================== test 12'
mkdir /mnt/lustre/d12
touch /mnt/lustre/d12/f
chmod 0666 /mnt/lustre/d12/f
$CLEAN
$START
-echo '=============================== test 13'
+echo '=================================================== test 13'
mkdir /mnt/lustre/d13
cp /etc/passwd /mnt/lustre/d13/f
> /mnt/lustre/d13/f
$START
-echo '=============================== test 14'
+echo '=================================================== test 14'
mkdir /mnt/lustre/d14
touch /mnt/lustre/d14/f
rm /mnt/lustre/d14/f
$START
-echo '=============================== test 15'
+echo '=================================================== test 15'
mkdir /mnt/lustre/d15
touch /mnt/lustre/d15/f
mv /mnt/lustre/d15/f /mnt/lustre/d15/f2
$CLEAN
$START
-echo '=============================== test 16'
+echo '=================================================== test 16'
mkdir /mnt/lustre/d16
touch /mnt/lustre/d16/f
rm -rf /mnt/lustre/d16/f
$CLEAN
$START
-echo '====== symlinks: create, remove symlinks (dangling and real) =====' test 17
+echo '== symlinks: create, remove (dangling and real) === test 17'
mkdir /mnt/lustre/d17
touch /mnt/lustre/d17/f
ln -s /mnt/lustre/d17/f /mnt/lustre/d17/l-exist
$CLEAN
$START
-echo '==== touch /mnt/lustre/f ; ls /mnt/lustre ==== test 18'
+echo '== touch /mnt/lustre/f ; ls /mnt/lustre ========== test 18'
touch /mnt/lustre/f
ls /mnt/lustre
$CLEAN
$START
-echo '==== touch /mnt/lustre/f ; ls -l /mnt/lustre ==== test 19'
+echo '== touch /mnt/lustre/f ; ls -l /mnt/lustre ======= test 19'
touch /mnt/lustre/f
ls -l /mnt/lustre
rm /mnt/lustre/f
$CLEAN
$START
-echo '==== touch /mnt/lustre/f ; ls -l /mnt/lustre ==== test 20'
+echo '== touch /mnt/lustre/f ; ls -l /mnt/lustre ======= test 20'
touch /mnt/lustre/f
rm /mnt/lustre/f
echo "1 done"
$CLEAN
$START
-echo '=========== finished ==========='
+echo '== write to dangling link ======================= test 21'
+mkdir /mnt/lustre/d21
+ln -s dangle /mnt/lustre/d21/link
+echo foo >> /mnt/lustre/d21/link
+cat /mnt/lustre/d21/dangle
+$CLEAN
+$START
+
+# echo '== unpack tar archive as nonroot user =========== test 22'
+echo '== please fix test 22'
+# mkdir /mnt/lustre/d22
+# chown 4711 /mnt/lustre/d22
+# (./setuid 4711 ; tar cf - /etc/hosts /etc/sysconfig/network | tar xfC - /mnt/lustre/d22 ; ./setuid 0)
+# ls -lR /mnt/lustre/d22/etc
+# $CLEAN
+# $START
+
+echo '== O_CREAT|O_EXCL in subdir ===================== test 23'
+mkdir /mnt/lustre/d23
+./toexcl /mnt/lustre/d23/f23
+./toexcl /mnt/lustre/d23/f23
+$CLEAN
+$START
+
+echo '======================= finished ======================='
exit
--- /dev/null
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/fsuid.h>
+
+int main(int argc, char ** argv)
+{
+ int rc, fsuid;
+
+ if (argc < 2) {
+ printf("Usage %s fsuid\n", argv[0]);
+ return 1;
+ }
+
+ fsuid = strtoul(argv[2], NULL, 0);
+ rc = setfsuid(fsuid);
+ if (rc) {
+ printf("mknod(%s) error: %s\n", argv[1], strerror(errno));
+ }
+ return rc;
+}
40 - mds, ost
50 - mdc, osc
60 - lov, lovconfig
- 70 - mountpoint
+ 70 - mountpoint, echo_client
"""
TODO = """
--ldap server LDAP server with lustre config database
rc, out = self.runcmd('device_list')
return out
+ # get lustre version
+ def lustre_version(self):
+ rc, out = self.runcmd('version')
+ return out
+
# ============================================================
# Various system-level functions
# (ideally moved to their own module)
class ECHO_CLIENT(Module):
def __init__(self,dom_node):
Module.__init__(self, 'ECHO_CLIENT', dom_node)
- self.obd_uuid = get_first_ref(dom_node, 'osc')
- debug("HERE",self.obd_uuid)
self.add_module('lustre/obdecho', 'obdecho')
+ self.lov_uuid = get_first_ref(dom_node, 'osc')
+ l = lookup(self.dom_node.parentNode, self.lov_uuid)
+ self.osc = VOSC(l)
def prepare(self):
if is_prepared(self.uuid):
return
- self.info(self.obd_uuid)
+ self.osc.prepare() # XXX This is so cheating. -p
+ self.info(self.lov_uuid)
lctl.newdev(attach="echo_client %s %s" % (self.name, self.uuid),
- setup = self.obd_uuid)
+ setup = self.lov_uuid)
def cleanup(self):
if not is_prepared(self.uuid):
return
- Module.cleanup(self)
+ self.osc.cleanup()
+
+ def load_module(self):
+ self.osc.load_module()
+ Module.load_module(self)
+ def cleanup_module(self):
+ Module.cleanup_module(self)
+ self.osc.cleanup_module()
class Mountpoint(Module):
n = MDS(dom_node)
elif type == 'osc':
n = VOSC(dom_node)
- elif type == 'echo_client':
- n = ECHO_CLIENT(dom_node)
elif type == 'mdc':
n = MDC(dom_node)
elif type == 'mountpoint':
n = Mountpoint(dom_node)
+ elif type == 'echo_client':
+ n = ECHO_CLIENT(dom_node)
else:
panic ("unknown service type:", type)
* Copyright (C) 2002 Cluster File Systems, Inc.
* Author: Peter J. Braam <braam@clusterfs.com>
* Author: Phil Schwan <phil@clusterfs.com>
- * Author: Robert Read <rread@clusterfs.com>
+ * Author: Robert Read <rread@clusterfs.com>
*
* This file is part of Lustre, http://www.lustre.org.
*
/* Network configuration commands */
{"==== network config ====", jt_noop, 0, "network config"},
{"network", jt_ptl_network, 0, "commands that follow apply to net\n"
- "usage: network <tcp/elan/myrinet>"},
+ "usage: network <tcp/elan/myrinet>"},
{"connect", jt_ptl_connect, 0, "connect to a remote nid\n"
"usage: connect [[<hostname> <port>] | <elan id>]"},
{"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid\n"
"if size is omited the current size is reported.\n"
"usage: send_mem [size]"},
{"nagle", jt_ptl_nagle, 0, "enable/disable nagle, omiting the "
- "argument will cause the current nagle setting to be reported.\n"
- "usage: nagle [on/off]"},
-
+ "argument will cause the current nagle setting to be reported.\n"
+ "usage: nagle [on/off]"},
+
/* Device selection commands */
{"=== device selection ===", jt_noop, 0, "device selection"},
{"newdev", jt_obd_newdev, 0, "create a new device\n"
"usage: device <devno>"},
{"device_list", jt_obd_list, 0, "show all devices\n"
"usage: device_list"},
-
+ {"lustre_build_version", jt_get_version, 0,
+ "print the build version of lustre\n"
+ "usage: lustre_build_version"},
+
/* Device configuration commands */
{"==== device config =====", jt_noop, 0, "device config"},
{"attach", jt_obd_attach, 0,
exit(2);
if (dbg_initialize(argc, argv) < 0)
exit(3);
-
+
if (argc > 1) {
rc = Parser_execarg(argc - 1, argv + 1, cmdlist);
} else {
{
$_ = shift;
# print "$_\n";
- /l. [0-9]* (.*)\):/;
+ /\(\) ([0-9]*)\+[0-9]*\):/;
return $1;
}
osc.appendChild(self.ref("obd", obd_uuid))
return osc
- def echo_client(self, name, uuid, osc_uuid):
- ec = self.newService("echo_client", name, uuid)
- ec.appendChild(self.ref("osc", osc_uuid))
- return ec
-
def ost(self, name, uuid, obd_uuid, net_uuid):
ost = self.newService("ost", name, uuid)
ost.appendChild(self.ref("network", net_uuid))
self.addElement(mtpt, "path", path)
return mtpt
+ def echo_client(self, name, uuid, osc_uuid):
+ ec = self.newService("echo_client", name, uuid)
+ ec.appendChild(self.ref("osc", osc_uuid))
+ return ec
+
############################################################
# Utilities to query a DOM tree
# Using this functions we can treat use config information
""" add an echo client to the profile for this node. """
if len(args) < 1:
usage()
- osc_name = args[0]
+ lov_name = args[0]
if options.has_key('node'):
node_name = options['node']
else:
echoname = new_name('ECHO_'+ node_name)
echo_uuid = new_uuid(echoname)
node_add_profile(gen, node, 'echo_client', echo_uuid)
- osc_uuid = name2uuid(lustre, osc_name) # either 'osc' or 'lov'
- echo = gen.echo_client(echoname, echo_uuid, osc_uuid)
+
+ lov_uuid = name2uuid(lustre, lov_name, tag='lov', fatal=0)
+ if not lov_uuid:
+ lov_uuid = name2uuid(lustre, lov_name, tag='osc', fatal=1)
+
+ echo = gen.echo_client(echoname, echo_uuid, lov_uuid)
lustre.appendChild(echo)
#include <linux/lustre_idl.h>
#include <linux/lustre_dlm.h>
#include <linux/obd_lov.h> /* for IOC_LOV_SET_OSC_ACTIVE */
+#include <linux/obd.h> /* for struct lov_stripe_md */
+#include <linux/lustre_build_version.h>
#include <unistd.h>
#include <sys/un.h>
int max = sizeof(rawbuf);
static int thread;
+static struct lov_stripe_md saved_lsm;
+static char lsm_valid = 0;
static int getfd(char *func);
static char *cmdname(char *func);
} \
} while (0)
+#define IOC_PACK(func, data) \
+do { \
+ if (obd_ioctl_pack(&data, &buf, max)) { \
+ fprintf(stderr, "error: %s: invalid ioctl\n", \
+ cmdname(func)); \
+ return -2; \
+ } \
+} while (0)
+
+#define IOC_UNPACK(func, data) \
+do { \
+ if (obd_ioctl_unpack(&data, buf, max)) { \
+ fprintf(stderr, "error: %s: invalid reply\n", \
+ cmdname(func)); \
+ return -2; \
+ } \
+} while (0)
+
char *obdo_print(struct obdo *obd)
{
char buf[1024];
data.ioc_inllen1 = strlen(name) + 1;
data.ioc_inlbuf1 = name;
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(func));
- return -2;
- }
+ IOC_PACK(func, data);
rc = ioctl(fd, OBD_IOC_NAME2DEV, buf);
if (rc < 0) {
fprintf(stderr, "error: %s: %s - %s\n", cmdname(func),
name, strerror(rc = errno));
return rc;
}
-
- memcpy((char *)(&data), buf, sizeof(data));
+ IOC_UNPACK(func, data);
return data.ioc_dev + N2D_OFF;
}
if (getfd(func))
return -1;
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(func));
- return -2;
- }
-
+ IOC_PACK(func, data);
return ioctl(fd, OBD_IOC_DEVICE, buf);
}
data.ioc_inlbuf1 = &force;
}
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
-
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, OBD_IOC_DETACH, buf);
if (rc < 0)
fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
return rc;
}
+int jt_get_version(int argc, char **argv)
+{
+ int rc;
+ char buf[8192];
+ struct obd_ioctl_data *data = (struct obd_ioctl_data *)buf;
+
+ if (getfd(argv[0]))
+ return -1;
+
+ memset(buf, 0, sizeof(buf));
+ data->ioc_version = OBD_IOCTL_VERSION;
+ data->ioc_addr = conn_addr;
+ data->ioc_cookie = conn_addr;
+ data->ioc_len = sizeof(buf);
+ data->ioc_inllen1 = sizeof(buf) - size_round(sizeof(*data));
+
+ if (argc != 1)
+ return CMD_HELP;
+
+ rc = ioctl(fd, OBD_GET_VERSION, data);
+ if (rc < 0)
+ fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
+ strerror(rc = errno));
+ else {
+ printf("Lustre version: %s\n", data->ioc_bulk);
+ }
+
+ printf("lctl version: %s\n",BUILD_VERSION);
+ return rc;
+}
+
int jt_obd_list(int argc, char **argv)
{
int rc;
data.ioc_inlbuf3 = argv[3];
}
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
-
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, OBD_IOC_ATTACH, buf);
if (rc < 0)
fprintf(stderr, "error: %s: %x %s\n", cmdname(argv[0]),
data.ioc_inlbuf2 = argv[2];
}
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, OBD_IOC_SETUP, buf);
if (rc < 0)
fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
return rc;
}
-
+/* The ioctl API has been extended to provide the LOV stripe metadata to the
+ * caller when applicable. This utility, however, only saves the LSM for the
+ * latest CREATE. */
int jt_obd_create(int argc, char **argv)
{
struct obd_ioctl_data data;
struct timeval next_time;
__u64 count = 1, next_count;
- int verbose = 1;
- int mode = 0100644;
- int rc = 0, i;
+ int verbose = 1, mode = 0100644, rc = 0, i;
char *end;
IOCINIT(data);
data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;;
- rc = ioctl(fd, OBD_IOC_CREATE, &data);
+ data.ioc_inllen1 = sizeof(saved_lsm);
+ data.ioc_inlbuf1 = (char *)&saved_lsm;
+
+ IOC_PACK(argv[0], data);
+ rc = ioctl(fd, OBD_IOC_CREATE, buf);
+ IOC_UNPACK(argv[0], data);
+ fprintf(stderr, "lsm->lsm_o_id: "LPX64"\n",
+ saved_lsm.lsm_object_id);
SHMEM_BUMP();
if (rc < 0) {
fprintf(stderr, "error: %s: #%d - %s\n",
break;
}
+ lsm_valid = 1;
+
if (be_verbose(verbose, &next_time, i, &next_count, count))
printf("%s: #%d is object id "LPX64"\n",
cmdname(argv[0]), i, data.ioc_obdo1.o_id);
}
data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE;
- rc = ioctl(fd, OBD_IOC_SETATTR, &data);
+ if (lsm_valid == 1) {
+ data.ioc_inllen1 = sizeof(saved_lsm);
+ data.ioc_inlbuf1 = (char *)&saved_lsm;
+ }
+
+ IOC_PACK(argv[0], data);
+ rc = ioctl(fd, OBD_IOC_SETATTR, buf);
if (rc < 0)
fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
strerror(rc = errno));
for (i = 1, next_count = verbose; i <= count; i++, id++) {
data.ioc_obdo1.o_id = id;
data.ioc_obdo1.o_mode = S_IFREG | 0644;
+ data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
- rc = ioctl(fd, OBD_IOC_DESTROY, &data);
+ data.ioc_inllen1 = sizeof(saved_lsm);
+ data.ioc_inlbuf1 = (char *)&saved_lsm;
+
+ IOC_PACK(argv[0], data);
+ rc = ioctl(fd, OBD_IOC_DESTROY, buf);
+ IOC_UNPACK(argv[0], data);
SHMEM_BUMP();
if (rc < 0) {
fprintf(stderr, "error: %s: objid "LPX64": %s\n",
cmdname(argv[0]), id, strerror(rc = errno));
break;
}
+ lsm_valid = 0;
if (be_verbose(verbose, &next_time, i, &next_count, count))
- printf("%s: #%d is object id 0x%Lx\n", cmdname(argv[0]),
- i, (long long)data.ioc_obdo1.o_id);
+ printf("%s: #%d is object id "LPX64"\n",
+ cmdname(argv[0]), i, id);
}
return rc;
data.ioc_obdo1.o_valid = 0xffffffff;
printf("%s: object id "LPX64"\n", cmdname(argv[0]),data.ioc_obdo1.o_id);
- rc = ioctl(fd, OBD_IOC_GETATTR, &data);
+ if (lsm_valid == 1) {
+ data.ioc_inllen1 = sizeof(saved_lsm);
+ data.ioc_inlbuf1 = (char *)&saved_lsm;
+ }
+
+ IOC_PACK(argv[0], data);
+ rc = ioctl(fd, OBD_IOC_GETATTR, buf);
+ IOC_UNPACK(argv[0], data);
if (rc) {
fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
strerror(rc = errno));
data.ioc_count = len;
data.ioc_offset = thr_offset * len * count;
+ if (lsm_valid == 1) {
+ data.ioc_inllen1 = sizeof(saved_lsm);
+ data.ioc_inlbuf1 = (char *)&saved_lsm;
+ }
+
gettimeofday(&start, NULL);
next_time.tv_sec = start.tv_sec - verbose;
next_time.tv_usec = start.tv_usec;
cmdname(argv[0]), write ? "writing" : "reading", count,
pages, objid, data.ioc_offset, ctime(&start.tv_sec));
- rc = ioctl(fd, OBD_IOC_OPEN, &data);
+ IOC_PACK(argv[0], data);
+ rc = ioctl(fd, OBD_IOC_OPEN, buf);
+ IOC_UNPACK(argv[0], data);
if (rc) {
fprintf(stderr, "error: brw_open: %s\n", strerror(rc = errno));
return rc;
rw = write ? OBD_IOC_BRW_WRITE : OBD_IOC_BRW_READ;
for (i = 1, next_count = verbose; i <= count; i++) {
- rc = ioctl(fd, rw, &data);
+ rc = ioctl(fd, rw, buf);
SHMEM_BUMP();
if (rc) {
fprintf(stderr, "error: %s: #%d - %s on %s\n",
i, pages, diff, (double)i * pages / diff,
ctime(&end.tv_sec));
}
- rw = ioctl(fd, OBD_IOC_CLOSE, &data);
+ rw = ioctl(fd, OBD_IOC_CLOSE, buf);
if (rw) {
fprintf(stderr, "error: brw_close: %s\n", strerror(rw = errno));
if (!rc)
rc = -EINVAL;
goto out;
}
-
rc = ioctl(fd, OBD_IOC_LOV_SET_CONFIG, buf);
if (rc)
fprintf(stderr, "error: %s: ioctl error: %s\n",
rc = -EINVAL;
goto out;
}
-
rc = ioctl(fd, OBD_IOC_LOV_GET_CONFIG, buf);
if (rc == -ENOSPC) {
free(uuidarray);
data.ioc_inllen1 = strlen(argstring) + 1;
}
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
-
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, IOC_LDLM_REGRESS_START, buf);
-
if (rc)
fprintf(stderr, "error: %s: test failed: %s\n",
cmdname(argv[0]), strerror(rc = errno));
/* reuse offset for 'active' */
data.ioc_offset = atoi(argv[2]);
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
-
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, IOC_LOV_SET_OSC_ACTIVE, buf);
-
if (rc)
fprintf(stderr, "error: %s: failed: %s\n",
cmdname(argv[0]), strerror(rc = errno));
data.ioc_inlbuf2 = argv[2];
}
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
-
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, OBD_IOC_RECOVD_NEWCONN, buf);
if (rc < 0)
fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
data.ioc_inllen1 = strlen(argv[1]) + 1;
data.ioc_inlbuf1 = argv[1];
- if (obd_ioctl_pack(&data, &buf, max)) {
- fprintf(stderr, "error: %s: invalid ioctl\n", cmdname(argv[0]));
- return -2;
- }
-
+ IOC_PACK(argv[0], data);
rc = ioctl(fd, OBD_IOC_RECOVD_FAILCONN, buf);
if (rc < 0)
fprintf(stderr, "error: %s: %s\n", cmdname(argv[0]),
"disconnect - break connection to device"},
/* Session operations */
- {"create", jt_obd_create, 0, "create [count [mode [verbose]]]"},
+ {"create", jt_obd_create, 0, "create <count> [mode [verbose]]"},
{"destroy", jt_obd_destroy, 0, "destroy <id> [count [verbose]]"},
{"getattr", jt_obd_getattr, 0, "getattr <id>"},
{"setattr", jt_obd_setattr, 0, "setattr <id> <mode>"},
int jt_obd_lov_set_osc_active(int argc, char **argv);
int jt_obd_newconn(int argc, char **argv);
int jt_obd_failconn(int argc, char **argv);
+int jt_get_version(int argc, char **argv);
#endif