Whamcloud - gitweb
- Temporary fix for the problem that the MDS needs to make lock requests to
authorpschwan <pschwan>
Wed, 17 Jul 2002 15:55:10 +0000 (15:55 +0000)
committerpschwan <pschwan>
Wed, 17 Jul 2002 15:55:10 +0000 (15:55 +0000)
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
lustre/llite/file.c

index eddf484..aa44911 100644 (file)
@@ -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);
index eecff78..cca46cc 100644 (file)
@@ -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);