Whamcloud - gitweb
- make_bad_inode as part of epoch-check mismatch handling
authorshaver <shaver>
Tue, 15 Oct 2002 20:54:30 +0000 (20:54 +0000)
committershaver <shaver>
Tue, 15 Oct 2002 20:54:30 +0000 (20:54 +0000)
- cleanup and comment-for-phil in ll_lock
- partial fix for the crash in recovery that I introduced with my patch yesterday
- better diagnostics in lustre_msg_buf
- finished, not free_req, in reconnection

lustre/include/linux/lustre_lite.h
lustre/llite/namei.c
lustre/mdc/mdc_request.c
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/recover.c

index 24afe9e..4174dab 100644 (file)
@@ -80,8 +80,10 @@ struct ll_sb_info {
 
 #define CHECK_MOUNT_EPOCH(i)                                                  \
 do {                                                                          \
-        if (ll_i2info(i)->lli_mount_epoch != ll_i2sbi(i)->ll_mount_epoch)     \
+        if (ll_i2info(i)->lli_mount_epoch != ll_i2sbi(i)->ll_mount_epoch) {   \
+                make_bad_inode(i);                                            \
                 RETURN(-EIO);                                                 \
+        }                                                                     \
 } while(0)
 
 static inline struct ll_sb_info *ll_s2sbi(struct super_block *sb)
index b8cf40c..cd02e57 100644 (file)
@@ -108,20 +108,20 @@ int ll_lock(struct inode *dir, struct dentry *dentry,
         int tgtlen = 0;
         int err, lock_mode;
 
-        if ((it->it_op & (IT_CREAT | IT_MKDIR | IT_SETATTR | IT_MKNOD)))
+        /* CREAT needs to be tested before open (both could be set) */
+        if ((it->it_op & (IT_CREAT | IT_MKDIR | IT_SETATTR | IT_MKNOD))) {
                 lock_mode = LCK_PW;
-        else if (it->it_op & (IT_READDIR | IT_GETATTR | IT_OPEN | IT_UNLINK |
-                              IT_RMDIR | IT_RENAME | IT_RENAME2 | IT_READLINK|
-                              IT_LINK | IT_LINK2))
+        } else if (it->it_op & (IT_READDIR | IT_GETATTR | IT_OPEN | IT_UNLINK |
+                                IT_RMDIR | IT_RENAME | IT_RENAME2 | IT_READLINK|
+                                IT_LINK | IT_LINK2 | IT_LOOKUP)) {
+                /* XXXphil PW for LINK2/RENAME2? */
                 lock_mode = LCK_PR;
-        else if (it->it_op & IT_SYMLINK) {
+        else if (it->it_op & IT_SYMLINK) {
                 lock_mode = LCK_PW;
                 tgt = it->it_data;
                 tgtlen = strlen(tgt);
                 it->it_data = NULL;
-        } else if (it->it_op & IT_LOOKUP)
-                lock_mode = LCK_PR;
-        else {
+        } else {
                 LBUG();
                 RETURN(-EINVAL);
         }
@@ -156,8 +156,10 @@ static struct dentry *ll_lookup2(struct inode *dir, struct dentry *dentry,
         ENTRY;
 
         /* CHECK_MOUNT_EPOCH(dir); */
-        if (ll_i2info(dir)->lli_mount_epoch != ll_i2sbi(dir)->ll_mount_epoch)
+        if (ll_i2info(dir)->lli_mount_epoch != ll_i2sbi(dir)->ll_mount_epoch) {
+                make_bad_inode(dir);
                 RETURN(ERR_PTR(-EIO));
+        }
 
         if (it == NULL) {
                 it = &lookup_it;
index 59a3b4f..5bfba9e 100644 (file)
@@ -285,7 +285,7 @@ int mdc_enqueue(struct lustre_handle *conn, int lock_type,
 
                 /* pack the intended request */
                 mds_link_pack(req, 2, old_de->d_inode, dir,
-                                de->d_name.name, de->d_name.len);
+                              de->d_name.name, de->d_name.len);
                 req->rq_replen = lustre_msg_size(3, repsize);
         } else if (it->it_op == IT_UNLINK || it->it_op == IT_RMDIR) {
                 size[2] = sizeof(struct mds_rec_unlink);
@@ -420,7 +420,7 @@ int mdc_open(struct lustre_handle *conn, obd_id ino, int type, int flags,
 
         /* If open is replayed, we need to fix up the fh. */
         req->rq_replay_cb = mdc_replay_open;
-        memcpy(&req->rq_replay_cb_handle, fh, sizeof(req->rq_replay_cb_handle));
+        memcpy(&req->rq_replay_cb_handle, fh, sizeof(fh));
 
         EXIT;
  out:
index ddd674c..82c2547 100644 (file)
@@ -339,10 +339,14 @@ int ptl_send_rpc(struct ptlrpc_request *request)
 
                 /* request->rq_repmsg is set only when the reply comes in, in
                  * client_packet_callback() */
-                if (request->rq_reply_md.start)
+                if (request->rq_reply_md.start) {
                         OBD_FREE(request->rq_reply_md.start,
                                  request->rq_replen);
-
+                        /* If we're resending, rq_repmsg needs to be NULLed out
+                         * again so that ptlrpc_check_reply doesn't trip early.
+                         */
+                        request->rq_repmsg = NULL;
+                }
                 OBD_ALLOC(repbuf, request->rq_replen);
                 if (!repbuf) {
                         LBUG();
@@ -380,6 +384,9 @@ int ptl_send_rpc(struct ptlrpc_request *request)
                        request->rq_import->imp_client->cli_reply_portal);
         }
 
+        /* Clear any flags that may be present from previous sends,
+         * except for REPLAY. */
+        request->rq_flags &= PTL_RPC_FL_REPLAY;
         rc = ptl_send_buf(request, request->rq_connection,
                           request->rq_import->imp_client->cli_request_portal);
         RETURN(rc);
index 3804bbc..dc537ec 100644 (file)
@@ -116,14 +116,15 @@ void *lustre_msg_buf(struct lustre_msg *m, int n)
         }
 
         if (n < 0 || n >= m->bufcount) {
-                CERROR("referencing bad sub buffer (want %d, count is %d)!\n",
-                       n, m->bufcount);
+                CERROR("referencing bad sub buffer in %p (want %d, count %d)!\n",
+                       m, n, m->bufcount);
                 LBUG();
                 return NULL;
         }
 
         if (m->buflens[n] == 0) {
-                CERROR("zero-length buffer requested for buffer %d\n", n);
+                CERROR("zero-length buffer requested for buffer %d in %p\n", n,
+                       m);
                 return NULL;
         }
 
index 70d549b..2260a5f 100644 (file)
@@ -78,7 +78,7 @@ static int ptlrpc_reconnect(struct ptlrpc_connection *conn)
                        cli->cl_target_uuid, conn->c_remote_uuid,
                        imp->imp_handle.addr, imp->imp_handle.cookie,
                        old_hdl.addr, old_hdl.cookie);
-                ptlrpc_free_req(request);
+                ptlrpc_req_finished(request);
         }
         conn->c_level = LUSTRE_CONN_RECOVD;