If ldlm_bl_to_thread() fails, call ldlm_handle_bl_callback() directly.
b=3267, b=3468
AC_INIT
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(lustre, 1.2.1.14)
+AM_INIT_AUTOMAKE(lustre, 1.2.2)
# AM_MAINTAINER_MODE
# Four main targets: lustre kernel modules, utilities, tests, and liblustre
extern int obd_memmax;
extern unsigned int obd_fail_loc;
extern unsigned int obd_timeout;
+extern unsigned int ldlm_timeout;
extern char obd_lustre_upcall[128];
extern unsigned int obd_sync_filter;
extern wait_queue_head_t obd_race_waitq;
void l_unlock(struct lustre_lock *lock)
{
- LASSERT(lock->l_owner == current);
- LASSERT(lock->l_depth >= 0);
+ LASSERTF(lock->l_owner == current, "lock %p, current %p\n",
+ lock->l_owner, current);
+ LASSERTF(lock->l_depth >= 0, "depth %d\n", lock->l_depth);
spin_lock(&lock->l_spin);
if (--lock->l_depth < 0) {
LDLM_LOCK_GET(lock); /* dropped by bl thread */
ldlm_lock_remove_from_lru(lock);
-#ifdef __KERNEL__
- ldlm_bl_to_thread(ns, NULL, lock);
- l_unlock(&ns->ns_lock);
-#else
l_unlock(&ns->ns_lock);
- ldlm_handle_bl_callback(ns, NULL, lock);
-#endif
+ if (ldlm_bl_to_thread(ns, NULL, lock) != 0)
+ ldlm_handle_bl_callback(ns, NULL, lock);
} else if (ns->ns_client == LDLM_NAMESPACE_CLIENT &&
!lock->l_readers && !lock->l_writers) {
/* If this is a client-side namespace and this was the last
extern struct list_head ldlm_namespace_list;
static DECLARE_MUTEX(ldlm_ref_sem);
-static int ldlm_refcount = 0;
+static int ldlm_refcount;
/* LDLM state */
/* this blocking AST will be communicated as part of the
* completion AST instead */
l_unlock(&lock->l_resource->lr_namespace->ns_lock);
- LDLM_DEBUG(lock, "lock not granted, not sending blocking AST"); RETURN(0);
+ LDLM_DEBUG(lock, "lock not granted, not sending blocking AST");
+ RETURN(0);
}
if (lock->l_destroyed) {
l_unlock(&lock->l_resource->lr_namespace->ns_lock);
req->rq_send_state = LUSTRE_IMP_FULL;
- req->rq_timeout = 2; /* 2 second timeout for initial AST reply */
+ req->rq_timeout = ldlm_timeout; /* timeout for initial AST reply */
rc = ptlrpc_queue_wait(req);
if (rc != 0)
rc = ldlm_handle_ast_error(lock, req, rc, "blocking");
req->rq_replen = lustre_msg_size(0, NULL);
req->rq_send_state = LUSTRE_IMP_FULL;
- req->rq_timeout = 2; /* 2 second timeout for initial AST reply */
+ req->rq_timeout = ldlm_timeout; /* timeout for initial AST reply */
/* We only send real blocking ASTs after the lock is granted */
l_lock(&lock->l_resource->lr_namespace->ns_lock);
req->rq_replen = lustre_msg_size(1, &size);
req->rq_send_state = LUSTRE_IMP_FULL;
- req->rq_timeout = 2; /* 2 second timeout for initial AST reply */
+ req->rq_timeout = ldlm_timeout; /* timeout for initial AST reply */
rc = ptlrpc_queue_wait(req);
if (rc == -ELDLM_NO_LOCK_DATA)
ptlrpc_error(req);
}
+ l_unlock(&ns->ns_lock);
if (lock->l_granted_mode == LCK_PW &&
!lock->l_readers && !lock->l_writers &&
time_after(jiffies, lock->l_last_used + 10 * HZ)) {
- l_unlock(&ns->ns_lock);
- ldlm_handle_bl_callback(ns, NULL, lock);
+ if (ldlm_bl_to_thread(ns, NULL, lock))
+ ldlm_handle_bl_callback(ns, NULL, lock);
EXIT;
return;
}
- l_unlock(&ns->ns_lock);
LDLM_LOCK_PUT(lock);
EXIT;
}
list_add_tail(&blwi->blwi_entry, &blp->blp_list);
wake_up(&blp->blp_waitq);
spin_unlock(&blp->blp_lock);
-#else
- LBUG();
-#endif
RETURN(0);
+#else
+ RETURN(-ENOSYS);
+#endif
}
static int ldlm_callback_handler(struct ptlrpc_request *req)
switch (req->rq_reqmsg->opc) {
case LDLM_BL_CALLBACK:
CDEBUG(D_INODE, "blocking ast\n");
-#ifdef __KERNEL__
- rc = ldlm_bl_to_thread(ns, &dlm_req->lock_desc, lock);
- ldlm_callback_reply(req, rc);
-#else
- rc = 0;
- ldlm_callback_reply(req, rc);
- ldlm_handle_bl_callback(ns, &dlm_req->lock_desc, lock);
-#endif
+ ldlm_callback_reply(req, 0);
+ if (ldlm_bl_to_thread(ns, &dlm_req->lock_desc, lock))
+ ldlm_handle_bl_callback(ns, &dlm_req->lock_desc, lock);
break;
case LDLM_CP_CALLBACK:
CDEBUG(D_INODE, "completion ast\n");
{
if ( ldlm_refcount )
CERROR("ldlm_refcount is %d in ldlm_exit!\n", ldlm_refcount);
- if (kmem_cache_destroy(ldlm_resource_slab) != 0)
- CERROR("couldn't free ldlm resource slab\n");
- if (kmem_cache_destroy(ldlm_lock_slab) != 0)
- CERROR("couldn't free ldlm lock slab\n");
+ LASSERTF(kmem_cache_destroy(ldlm_resource_slab) == 0,
+ "couldn't free ldlm resource slab\n");
+ LASSERTF(kmem_cache_destroy(ldlm_lock_slab) == 0,
+ "couldn't free ldlm lock slab\n");
}
/* ldlm_flock.c */
LDLM_LOCK_GET(lock); /* dropped by bl thread */
ldlm_lock_remove_from_lru(lock);
- if (sync == LDLM_ASYNC)
- ldlm_bl_to_thread(ns, NULL, lock);
- else
+ if (sync != LDLM_ASYNC || ldlm_bl_to_thread(ns, NULL, lock))
list_add(&lock->l_lru, &cblist);
if (--count == 0)
unregister_filesystem(&lustre_lite_fs_type);
unregister_filesystem(&lustre_fs_type);
- kmem_cache_destroy(ll_file_data_slab);
+ LASSERTF(kmem_cache_destroy(ll_file_data_slab) == 0,
+ "couldn't destroy ll_file_data slab\n");
if (proc_lustre_fs_root) {
lprocfs_remove(proc_lustre_fs_root);
void ll_destroy_inodecache(void)
{
- if (kmem_cache_destroy(ll_inode_cachep))
- CERROR("ll_inode_cache: not all structures were freed\n");
+ LASSERTF(kmem_cache_destroy(ll_inode_cachep) == 0,
+ "ll_inode_cache: not all structures were freed\n");
}
/* exported operations */
unregister_filesystem(&lustre_fs_type);
unregister_filesystem(&lustre_lite_fs_type);
ll_destroy_inodecache();
- kmem_cache_destroy(ll_file_data_slab);
+ LASSERTF(kmem_cache_destroy(ll_file_data_slab) == 0,
+ "couldn't destroy ll_file_data slab\n");
if (proc_lustre_fs_root) {
lprocfs_remove(proc_lustre_fs_root);
proc_lustre_fs_root = NULL;
static void __exit fsfilt_ext3_exit(void)
{
- int rc;
-
fsfilt_unregister_ops(&fsfilt_ext3_ops);
- rc = kmem_cache_destroy(fcb_cache);
-
- if (rc || atomic_read(&fcb_cache_count)) {
- CERROR("can't free fsfilt callback cache: count %d, rc = %d\n",
- atomic_read(&fcb_cache_count), rc);
- }
+ LASSERTF(kmem_cache_destroy(fcb_cache) == 0,
+ "can't free fsfilt callback cache: count %d\n",
+ atomic_read(&fcb_cache_count));
//rc = ext3_xattr_unregister();
}
int rc = 0;
ENTRY;
- body = lustre_swab_reqbuf (req, offset, sizeof (*body),
- lustre_swab_mds_body);
+ body = lustre_swab_reqbuf(req, offset, sizeof(*body),
+ lustre_swab_mds_body);
if (body == NULL) {
- CERROR ("Can't unpack body\n");
- RETURN (-EFAULT);
+ CERROR("Can't unpack body\n");
+ RETURN(-EFAULT);
}
uc.ouc_fsuid = body->fsuid;
push_ctxt(&saved, &obd->obd_ctxt, &uc);
de = mds_fid2dentry(mds, &body->fid1, NULL);
if (IS_ERR(de)) {
- rc = req->rq_status = -ENOENT;
- GOTO(out_pop, PTR_ERR(de));
+ rc = req->rq_status = PTR_ERR(de);
+ GOTO(out_pop, rc);
}
rc = mds_getattr_pack_msg(req, de->d_inode, offset);
if (rc != 0) {
- CERROR ("mds_getattr_pack_msg: %d\n", rc);
- GOTO (out_pop, rc);
+ CERROR("mds_getattr_pack_msg: %d\n", rc);
+ GOTO(out_pop, rc);
}
req->rq_status = mds_getattr_internal(obd, de, req, body, 0);
/* The following are visible and mutable through /proc/sys/lustre/. */
unsigned int obd_fail_loc;
unsigned int obd_timeout = 100;
+unsigned int ldlm_timeout = 6;
char obd_lustre_upcall[128] = "DEFAULT"; /* or NONE or /full/path/to/upcall */
unsigned int obd_sync_filter; /* = 0, don't sync by default */
EXPORT_SYMBOL(obd_fail_loc);
EXPORT_SYMBOL(obd_race_waitq);
EXPORT_SYMBOL(obd_timeout);
+EXPORT_SYMBOL(ldlm_timeout);
EXPORT_SYMBOL(obd_lustre_upcall);
EXPORT_SYMBOL(obd_sync_filter);
EXPORT_SYMBOL(ptlrpc_put_connection_superhack);
struct obd_device * class_devices_in_group(struct obd_uuid *grp_uuid, int *next)
{
int i;
- if (next == NULL)
+ if (next == NULL)
i = 0;
else if (*next >= 0 && *next < MAX_OBD_DEVICES)
i = *next;
- else
+ else
return NULL;
-
+
for (; i < MAX_OBD_DEVICES; i++) {
struct obd_device *obd = &obd_dev[i];
if (obd->obd_type == NULL)
void obd_cleanup_caches(void)
{
- int rc;
ENTRY;
if (obdo_cachep) {
- rc = kmem_cache_destroy(obdo_cachep);
- if (rc)
- CERROR("Cannot destory ll_obdo_cache\n");
+ LASSERTF(kmem_cache_destroy(obdo_cachep) == 0,
+ "Cannot destory ll_obdo_cache\n");
obdo_cachep = NULL;
}
if (import_cachep) {
- rc = kmem_cache_destroy(import_cachep);
- if (rc)
- CERROR("Cannot destory ll_import_cache\n");
+ LASSERTF(kmem_cache_destroy(import_cachep) == 0,
+ "Cannot destory ll_import_cache\n");
import_cachep = NULL;
}
EXIT;
OBD_TIMEOUT, /* RPC timeout before recovery/intr */
OBD_UPCALL, /* path to recovery upcall */
OBD_SYNCFILTER, /* XXX temporary, as we play with sync osts.. */
+ OBD_LDLM_TIMEOUT, /* LDLM timeout for ASTs before client eviction */
};
int proc_fail_loc(ctl_table *table, int write, struct file *filp,
&proc_dostring, &sysctl_string },
{OBD_SYNCFILTER, "filter_sync_on_commit", &obd_sync_filter, sizeof(int),
0644, NULL, &proc_dointvec},
+ {OBD_TIMEOUT, "ldlm_timeout", &ldlm_timeout, sizeof(int), 0644, NULL,
+ &proc_dointvec},
{ 0 }
};
{
struct ldlm_lock *lock = ldlm_handle2lock(lockh);
- LASSERTF(lock != NULL, "lockh %p, data %p\n", lockh, data);
+ if (lock == NULL) {
+ CERROR("lockh %p, data %p - client evicted?\n", lockh, data);
+ return;
+ }
l_lock(&lock->l_resource->lr_namespace->ns_lock);
#ifdef __KERNEL__
if (lock->l_ast_data && lock->l_ast_data != data) {
rc = ldlm_lock_match(obd->obd_namespace, *flags, &res_id, type,
policy, mode, lockh);
if (rc) {
- if (!(*flags & LDLM_FL_TEST_LOCK))
+ //if (!(*flags & LDLM_FL_TEST_LOCK))
osc_set_data_with_check(lockh, data);
RETURN(rc);
}
struct obd_import *imp = req->rq_import;
ENTRY;
- DEBUG_REQ(D_ERROR, req, "timeout");
+ DEBUG_REQ(D_ERROR, req, "timeout (sent %lu)", (long)req->rq_sent);
spin_lock_irqsave (&req->rq_lock, flags);
req->rq_timedout = 1;
}
RETURN(timeout);
}
-
int ptlrpc_set_wait(struct ptlrpc_request_set *set)
{
timeout = 1;
} else {
timeout = MAX(req->rq_timeout * HZ, 1);
- DEBUG_REQ(D_NET, req, "-- sleeping");
+ DEBUG_REQ(D_NET, req, "-- sleeping for %d jiffies", timeout);
}
lwi = LWI_TIMEOUT_INTR(timeout, expired_request, interrupted_request,
req);
struct ptlrpc_srv_ni *srv_ni = rqbd->rqbd_srv_ni;
struct ptlrpc_service *service = srv_ni->sni_service;
struct ptlrpc_request *req;
- long flags;
+ unsigned long flags;
ENTRY;
LASSERT (ev->type == PTL_EVENT_PUT ||
* client's timeout is similar to mine, she'll be timing out this
* REQ anyway (bug 1502) */
if (timediff / 1000000 > (long)obd_timeout) {
- CERROR("Dropping timed-out request from "LPX64
- ": %ld seconds old\n",
+ CERROR("Dropping timed-out opc %d request from "LPX64
+ ": %ld seconds old\n", request->rq_reqmsg->opc,
request->rq_peer.peer_nid, timediff / 1000000);
goto out;
}