From 6128317608549d655212b985b0f1e21d8b6a6a63 Mon Sep 17 00:00:00 2001 From: pschwan Date: Tue, 24 Sep 2002 17:06:33 +0000 Subject: [PATCH] Back out the piece of the locking fix that caused the problem, until I can actually fix it. --- lustre/include/linux/lustre_dlm.h | 7 ++----- lustre/include/linux/lustre_lite.h | 2 +- lustre/ldlm/ldlm_lock.c | 7 ++----- lustre/ldlm/ldlm_lockd.c | 10 ++-------- lustre/ldlm/ldlm_test.c | 26 ++++++++------------------ lustre/llite/file.c | 28 ++++++++++------------------ lustre/mdc/mdc_request.c | 35 ++++++++++++++--------------------- lustre/mds/handler.c | 7 +------ 8 files changed, 40 insertions(+), 82 deletions(-) diff --git a/lustre/include/linux/lustre_dlm.h b/lustre/include/linux/lustre_dlm.h index 41116b4..1efcdca 100644 --- a/lustre/include/linux/lustre_dlm.h +++ b/lustre/include/linux/lustre_dlm.h @@ -39,9 +39,6 @@ typedef enum { #define LDLM_FL_DESTROYED (1 << 6) #define LDLM_FL_WAIT_NOREPROC (1 << 7) -#define LDLM_CB_BLOCKING 1 -#define LDLM_CB_DYING 2 - #define L2B(c) (1 << c) /* compatibility matrix */ @@ -115,7 +112,7 @@ struct ldlm_lock; typedef int (*ldlm_blocking_callback)(struct ldlm_lock *lock, struct ldlm_lock_desc *new, void *data, - __u32 data_len, int flag); + __u32 data_len); typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, int flags); @@ -373,7 +370,7 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *, __u64 *, int local_only); /* mds/handler.c */ /* This has to be here because recurisve inclusion sucks. */ int mds_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, __u32 data_len, int flag); + void *data, __u32 data_len); #endif /* __KERNEL__ */ diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h index 23912d5..c853fee 100644 --- a/lustre/include/linux/lustre_lite.h +++ b/lustre/include/linux/lustre_lite.h @@ -148,7 +148,7 @@ extern struct file_operations ll_file_operations; extern struct inode_operations ll_file_inode_operations; struct ldlm_lock; int ll_lock_callback(struct ldlm_lock *, struct ldlm_lock_desc *, void *data, - __u32 data_len, int flag); + __u32 data_len); int ll_size_lock(struct inode *, struct lov_stripe_md *, __u64 start, int mode, struct lustre_handle **); int ll_size_unlock(struct inode *, struct lov_stripe_md *, int mode, diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index ce54c32..0b14101 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -152,9 +152,6 @@ void ldlm_lock_put(struct ldlm_lock *lock) LDLM_LOCK_PUT(lock->l_parent); if (lock->l_refc == 0 && (lock->l_flags & LDLM_FL_DESTROYED)) { - lock->l_blocking_ast(lock, NULL, lock->l_data, - lock->l_data_len, LDLM_CB_DYING); - spin_lock(&ns->ns_counter_lock); ns->ns_locks--; spin_unlock(&ns->ns_counter_lock); @@ -428,7 +425,7 @@ void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode) /* FIXME: need a real 'desc' here */ lock->l_blocking_ast(lock, NULL, lock->l_data, - lock->l_data_len, LDLM_CB_BLOCKING); + lock->l_data_len); } else l_unlock(&lock->l_resource->lr_namespace->ns_lock); @@ -744,7 +741,7 @@ void ldlm_run_ast_work(struct list_head *rpc_list) if (w->w_blocking) rc = w->w_lock->l_blocking_ast (w->w_lock, &w->w_desc, w->w_data, - w->w_datalen, LDLM_CB_BLOCKING); + w->w_datalen); else rc = w->w_lock->l_completion_ast(w->w_lock, w->w_flags); if (rc) diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 8d96b50..a6ede2f 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -115,18 +115,13 @@ static int ldlm_del_waiting_lock(struct ldlm_lock *lock) static int ldlm_server_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, __u32 data_len, int flag) + void *data, __u32 data_len) { struct ldlm_request *body; struct ptlrpc_request *req; int rc = 0, size = sizeof(*body); ENTRY; - if (flag == LDLM_CB_DYING) { - /* Don't need to do anything when the lock is freed. */ - RETURN(0); - } - req = ptlrpc_prep_req(&lock->l_export->exp_ldlm_data.led_import, LDLM_BL_CALLBACK, 1, &size, NULL); if (!req) @@ -396,8 +391,7 @@ static int ldlm_handle_bl_callback(struct ptlrpc_request *req) "callback (%p)", lock->l_blocking_ast); if (lock->l_blocking_ast != NULL) { lock->l_blocking_ast(lock, &dlm_req->lock_desc, - lock->l_data, lock->l_data_len, - LDLM_CB_BLOCKING); + lock->l_data, lock->l_data_len); } } else LDLM_DEBUG(lock, "Lock still has references, will be" diff --git a/lustre/ldlm/ldlm_test.c b/lustre/ldlm/ldlm_test.c index b5f5e748..d445cad 100644 --- a/lustre/ldlm/ldlm_test.c +++ b/lustre/ldlm/ldlm_test.c @@ -75,26 +75,17 @@ static int ldlm_do_convert(void); */ static int ldlm_test_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *new, - void *data, __u32 data_len, int flag) + void *data, __u32 data_len) { int rc; struct lustre_handle lockh; ENTRY; - switch (flag) { - case LDLM_CB_BLOCKING: - LDLM_DEBUG(lock, "We're blocking. Cancelling lock"); - ldlm_lock2handle(lock, &lockh); - rc = ldlm_cli_cancel(&lockh); - if (rc < 0) { - CERROR("ldlm_cli_cancel: %d\n", rc); - LBUG(); - } - break; - case LDLM_CB_DYING: - LDLM_DEBUG(lock, "this lock is being freed"); - break; - default: + LDLM_DEBUG(lock, "We're blocking. Cancelling lock"); + ldlm_lock2handle(lock, &lockh); + rc = ldlm_cli_cancel(&lockh); + if (rc < 0) { + CERROR("ldlm_cli_cancel: %d\n", rc); LBUG(); } @@ -104,11 +95,10 @@ static int ldlm_test_blocking_ast(struct ldlm_lock *lock, /* blocking ast for basic tests. noop */ static int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *new, - void *data, __u32 data_len, int flag) + void *data, __u32 data_len) { ENTRY; - CERROR("ldlm_blocking_ast: lock=%p, new=%p, flag=%d\n", lock, new, - flag); + CERROR("ldlm_blocking_ast: lock=%p, new=%p\n", lock, new); RETURN(0); } diff --git a/lustre/llite/file.c b/lustre/llite/file.c index d86b313..02c8832 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -339,7 +339,7 @@ static void ll_update_atime(struct inode *inode) } int ll_lock_callback(struct ldlm_lock *lock, struct ldlm_lock_desc *new, - void *data, __u32 data_len, int flag) + void *data, __u32 data_len) { struct inode *inode = data; struct lustre_handle lockh; @@ -352,24 +352,16 @@ int ll_lock_callback(struct ldlm_lock *lock, struct ldlm_lock_desc *new, if (inode == NULL) LBUG(); - switch (flag) { - case LDLM_CB_BLOCKING: - ldlm_lock2handle(lock, &lockh); - rc = ldlm_cli_cancel(&lockh); - if (rc != ELDLM_OK) - CERROR("ldlm_cli_cancel failed: %d\n", rc); - break; - case LDLM_CB_DYING: - down(&inode->i_sem); - CDEBUG(D_INODE, "invalidating obdo/inode %ld\n", inode->i_ino); - /* FIXME: do something better than throwing away everything */ - invalidate_inode_pages(inode); - up(&inode->i_sem); - break; - default: - LBUG(); - } + down(&inode->i_sem); + CDEBUG(D_INODE, "invalidating obdo/inode %ld\n", inode->i_ino); + /* FIXME: do something better than throwing away everything */ + invalidate_inode_pages(inode); + up(&inode->i_sem); + ldlm_lock2handle(lock, &lockh); + rc = ldlm_cli_cancel(&lockh); + if (rc != ELDLM_OK) + CERROR("ldlm_cli_cancel failed: %d\n", rc); RETURN(0); } diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 1ee50ab..bbf9a6f 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -152,7 +152,7 @@ int mdc_getattr(struct lustre_handle *conn, } static int mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, __u32 data_len, int flag) + void *data, __u32 data_len) { int rc; struct inode *inode = data; @@ -166,29 +166,22 @@ static int mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, RETURN(-EINVAL); } - switch (flag) { - case LDLM_CB_BLOCKING: - ldlm_lock2handle(lock, &lockh); - rc = ldlm_cli_cancel(&lockh); - if (rc < 0) { - CERROR("ldlm_cli_cancel: %d\n", rc); - LBUG(); - } - break; - case LDLM_CB_DYING: - /* FIXME: do something better than throwing away everything */ - if (inode == NULL) - LBUG(); - if (S_ISDIR(inode->i_mode)) { - CDEBUG(D_INODE, "invalidating inode %ld\n", - inode->i_ino); - invalidate_inode_pages(inode); - } - break; - default: + if (inode == NULL) LBUG(); + + /* FIXME: do something better than throwing away everything */ + if (S_ISDIR(inode->i_mode)) { + CDEBUG(D_INODE, "invalidating inode %ld\n", + inode->i_ino); + invalidate_inode_pages(inode); } + ldlm_lock2handle(lock, &lockh); + rc = ldlm_cli_cancel(&lockh); + if (rc < 0) { + CERROR("ldlm_cli_cancel: %d\n", rc); + LBUG(); + } RETURN(0); } diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 0edd444..539e50b 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -414,16 +414,11 @@ static int mds_getlovinfo(struct ptlrpc_request *req) } int mds_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, - void *data, __u32 data_len, int flag) + void *data, __u32 data_len) { int do_ast; ENTRY; - if (flag == LDLM_CB_DYING) { - /* Don't need to do anything when the lock is freed. */ - RETURN(0); - } - l_lock(&lock->l_resource->lr_namespace->ns_lock); lock->l_flags |= LDLM_FL_CBPENDING; do_ast = (!lock->l_readers && !lock->l_writers); -- 1.8.3.1