Whamcloud - gitweb
LU-824 corrupted ldiskfs after md rebuild (bz24264)
[fs/lustre-release.git] / lustre / ptlrpc / llog_server.c
index 8259bd1..3929127 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -83,12 +83,15 @@ int llog_origin_handle_create(struct ptlrpc_request *req)
                 name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
                 if (name == NULL)
                         RETURN(-EFAULT);
-                CDEBUG(D_INFO, "opening log %s\n", name);
+                CDEBUG(D_INFO, "%s: opening log %s\n", obd->obd_name, name);
         }
 
         ctxt = llog_get_context(obd, body->lgd_ctxt_idx);
-        if (ctxt == NULL)
+        if (ctxt == NULL) {
+                CDEBUG(D_WARNING, "%s: no ctxt. group=%p idx=%d name=%s\n",
+                       obd->obd_name, &obd->obd_olg, body->lgd_ctxt_idx, name);
                 RETURN(-ENODEV);
+        }
         disk_obd = ctxt->loc_exp->exp_obd;
         push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
 
@@ -340,8 +343,8 @@ int llog_origin_handle_read_header(struct ptlrpc_request *req)
         if (rc)
                 GOTO(out_pop, rc);
 
-        /* 
-         * llog_init_handle() reads the llog header 
+        /*
+         * llog_init_handle() reads the llog header
          */
         flags = body->lgd_llh_flags;
         rc = llog_init_handle(loghandle, flags, NULL);
@@ -407,28 +410,28 @@ int llog_origin_handle_cancel(struct ptlrpc_request *req)
                 handle = fsfilt_start_log(disk_obd, inode,
                                           FSFILT_OP_CANCEL_UNLINK, NULL, 1);
                 if (IS_ERR(handle)) {
-                        CERROR("fsfilt_start_log() failed: %ld\n", 
+                        CERROR("fsfilt_start_log() failed: %ld\n",
                                PTR_ERR(handle));
                         GOTO(pop_ctxt, rc = PTR_ERR(handle));
                 }
 
                 rc = llog_cat_cancel_records(cathandle, 1, logcookies);
 
-                /* 
+                /*
                  * Do not raise -ENOENT errors for resent rpcs. This rec already
-                 * might be killed. 
+                 * might be killed.
                  */
-                if (rc == -ENOENT && 
+                if (rc == -ENOENT &&
                     (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT)) {
-                        /* 
+                        /*
                          * Do not change this message, reply-single.sh test_59b
-                         * expects to find this in log. 
+                         * expects to find this in log.
                          */
                         CDEBUG(D_RPCTRACE, "RESENT cancel req %p - ignored\n",
                                req);
                         rc = 0;
                 } else if (rc == 0) {
-                        CDEBUG(D_RPCTRACE, "Canceled %d llog-records\n", 
+                        CDEBUG(D_RPCTRACE, "Canceled %d llog-records\n",
                                num_cookies);
                 }
 
@@ -446,7 +449,7 @@ int llog_origin_handle_cancel(struct ptlrpc_request *req)
 pop_ctxt:
         pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
         if (rc)
-                CERROR("Cancel %d of %d llog-records failed: %d\n", 
+                CERROR("Cancel %d of %d llog-records failed: %d\n",
                        failed, num_cookies, rc);
 
         llog_ctxt_put(ctxt);
@@ -543,7 +546,7 @@ static int llog_catinfo_cb(struct llog_handle *cat,
 
         if (!cbd->ctxt)
                 RETURN(-ENODEV);
-        
+
         lir = (struct llog_logid_rec *)rec;
         logid = &lir->lid_id;
         rc = llog_create(ctxt, &handle, logid, NULL);
@@ -561,7 +564,7 @@ static int llog_catinfo_cb(struct llog_handle *cat,
         l = snprintf(out, remains, "\t[Log ID]: #"LPX64"#"LPX64"#%08x\n"
                      "\tLog Size: %llu\n\tLast Index: %d\n"
                      "\tUncanceled Records: %d\n",
-                     logid->lgl_oid, logid->lgl_ogr, logid->lgl_ogen,
+                     logid->lgl_oid, logid->lgl_oseq, logid->lgl_ogen,
                      i_size_read(handle->lgh_file->f_dentry->d_inode),
                      handle->lgh_last_idx, count);
         out += l;
@@ -598,12 +601,12 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
         count = mds->mds_lov_desc.ld_tgt_count;
         size = sizeof(*idarray) * count;
 
-        OBD_VMALLOC(idarray, size);
+        OBD_ALLOC_LARGE(idarray, size);
         if (!idarray)
                 GOTO(release_ctxt, rc = -ENOMEM);
 
-        mutex_down(&obd->obd_olg.olg_cat_processing);
-        rc = llog_get_cat_list(obd, obd, name, 0, count, idarray);
+        cfs_mutex_down(&obd->obd_olg.olg_cat_processing);
+        rc = llog_get_cat_list(obd, name, 0, count, idarray);
         if (rc)
                 GOTO(out_free, rc);
 
@@ -631,7 +634,7 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
                              "\n[Catlog ID]: #"LPX64"#"LPX64"#%08x  "
                              "[Log Count]: %d\n",
                              idarray[i].lci_logid.lgl_oid,
-                             idarray[i].lci_logid.lgl_ogr,
+                             idarray[i].lci_logid.lgl_oseq,
                              idarray[i].lci_logid.lgl_ogen, uncanceled);
 
                 data.out += l;
@@ -648,8 +651,8 @@ static int llog_catinfo_deletions(struct obd_device *obd, char *buf,
 out_pop:
         pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_lvfs_ctxt, NULL);
 out_free:
-        mutex_up(&obd->obd_olg.olg_cat_processing);
-        OBD_VFREE(idarray, size);
+        cfs_mutex_up(&obd->obd_olg.olg_cat_processing);
+        OBD_FREE_LARGE(idarray, size);
 release_ctxt:
         llog_ctxt_put(ctxt);
         return rc;