From 76a9ab919771f51a3cdf3200cf1e99bc99177b8c Mon Sep 17 00:00:00 2001 From: pschwan Date: Wed, 17 Jul 2002 15:55:10 +0000 Subject: [PATCH] - Temporary fix for the problem that the MDS needs to make lock requests to itself, but doesn't go through the whole connection setup nonsense, so its connection never advances above LUSTRE_CONN_NEW level - Right after we failed to get a lock in the I/O patch, we tried to debug-print it. Fixed. --- lustre/ldlm/ldlm_request.c | 12 ++++++++++++ lustre/llite/file.c | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index eddf484..aa44911 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -76,6 +76,18 @@ int ldlm_cli_enqueue(struct ptlrpc_client *cl, struct ptlrpc_connection *conn, lock->l_connection = ptlrpc_connection_addref(conn); lock->l_client = cl; + /* I apologize in advance for what I am about to do. + * + * The MDS needs to send lock requests to itself, but it doesn't want to + * go through the whole hassle of setting up proper connections. Soon, + * these will just be function calls, but until I have the time, just + * send these requests at level NEW, so that they go through. + * + * Since the MDS is the only user of PLAIN locks right now, we can use + * that to distinguish. Sorry. */ + if (type == LDLM_PLAIN) + req->rq_level = LUSTRE_CONN_NEW; + rc = ptlrpc_queue_wait(req); /* FIXME: status check here? */ rc = ptlrpc_check_status(req, rc); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index eecff78..cca46cc 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -265,8 +265,10 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count, &extent, sizeof(extent), LCK_PR, &flags, ll_lock_callback, inode, sizeof(*inode), &lockh); - if (err != ELDLM_OK) + if (err != ELDLM_OK) { CERROR("lock enqueue: err: %d\n", err); + RETURN(err); + } ldlm_lock_dump((void *)(unsigned long)lockh.addr); } @@ -279,8 +281,10 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count, if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK)) { err = obd_cancel(&sbi->ll_osc_conn, LCK_PR, &lockh); - if (err != ELDLM_OK) + if (err != ELDLM_OK) { CERROR("lock cancel: err: %d\n", err); + RETURN(err); + } } RETURN(retval); @@ -315,8 +319,10 @@ ll_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) &extent, sizeof(extent), LCK_PW, &flags, ll_lock_callback, inode, sizeof(*inode), &lockh); - if (err != ELDLM_OK) + if (err != ELDLM_OK) { CERROR("lock enqueue: err: %d\n", err); + RETURN(err); + } ldlm_lock_dump((void *)(unsigned long)lockh.addr); } @@ -327,8 +333,10 @@ ll_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) if (!(fd->fd_flags & LL_FILE_IGNORE_LOCK)) { err = obd_cancel(&sbi->ll_osc_conn, LCK_PW, &lockh); - if (err != ELDLM_OK) + if (err != ELDLM_OK) { CERROR("lock cancel: err: %d\n", err); + RETURN(err); + } } RETURN(retval); -- 1.8.3.1