Whamcloud - gitweb
LU-695 clean up for OBD_FAIL_CHECK_ONCE
authoryangsheng <ys@whamcloud.com>
Sun, 25 Sep 2011 13:45:19 +0000 (21:45 +0800)
committerJohann Lombardi <johann@whamcloud.com>
Wed, 16 Nov 2011 10:42:55 +0000 (05:42 -0500)
Clean up for OBD_FAIL_CHECK_ONCE. Just use OBD_FAIL_CHECK.

Signed-off-by: Chris Horn <hornc@cray.com>
Signed-off-by: Yang Sheng <ys@whamcloud.com>
Change-Id: I86bb314a052d74da6f3be1d4b85aa287f706ed36
Reviewed-on: http://review.whamcloud.com/1424
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/include/obd_support.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lockd.c
lustre/mds/handler.c
lustre/mds/mds_fs.c
lustre/mds/mds_open.c
lustre/obdclass/llog_cat.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/ptlrpc/niobuf.c
lustre/quota/quota_context.c

index 5070f6a..ada8d35 100644 (file)
@@ -370,9 +370,6 @@ int obd_fail_check(__u32 id);
 #define OBD_FAIL_CHECK_QUIET(id)                                             \
         (unlikely(obd_fail_loc) ? obd_fail_check(id) : 0)
 
-/* deprecated - just use OBD_FAIL_CHECK */
-#define OBD_FAIL_CHECK_ONCE OBD_FAIL_CHECK
-
 #define OBD_FAIL_RETURN(id, ret)                                             \
 do {                                                                         \
         if (unlikely(obd_fail_loc && obd_fail_check(id))) {                  \
index 3666723..442599c 100644 (file)
@@ -2071,7 +2071,7 @@ int target_handle_dqacq_callback(struct ptlrpc_request *req)
         int repsize[2] = { sizeof(struct ptlrpc_body), 0 };
         ENTRY;
 
-        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_DROP_QUOTA_REQ))
+        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_DROP_QUOTA_REQ))
                 RETURN(rc);
 
         repsize[1] = quota_get_qunit_data_size(req->rq_export->
index c460bed..8ae069d 100644 (file)
@@ -1144,7 +1144,7 @@ existing_lock:
                 }
                 unlock_res_and_lock(lock);
 
-                if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR))
+                if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR))
                         GOTO(out, rc = -ENOMEM);
 
                 rc = lustre_pack_reply(req, buffers, size, NULL);
@@ -1180,7 +1180,7 @@ existing_lock:
         /* Don't move a pending lock onto the export if it has already
          * been evicted.  Cancel it now instead. (bug 5683) */
         if (req->rq_export->exp_failed ||
-            OBD_FAIL_CHECK_ONCE(OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT)) {
+            OBD_FAIL_CHECK(OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT)) {
                 LDLM_ERROR(lock, "lock on destroyed export %p", req->rq_export);
                 rc = -ENOTCONN;
         } else if (lock->l_flags & LDLM_FL_AST_SENT) {
index 1288132..5e2be7f 100644 (file)
@@ -1622,7 +1622,7 @@ int mds_handle(struct ptlrpc_request *req)
                 OBD_FAIL_RETURN(OBD_FAIL_MDS_READPAGE_NET, 0);
                 rc = mds_readpage(req, REQ_REC_OFF);
 
-                if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_SENDPAGE)) {
+                if (OBD_FAIL_CHECK(OBD_FAIL_MDS_SENDPAGE)) {
                         RETURN(0);
                 }
 
index 99fe802..ec87c4b 100644 (file)
@@ -187,7 +187,7 @@ int mds_client_add(struct obd_device *obd, struct obd_export *exp,
                 cl_idx = find_first_zero_bit(bitmap, LR_MAX_CLIENTS);
         repeat:
                 if (cl_idx >= LR_MAX_CLIENTS ||
-                    OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_CLIENT_ADD)) {
+                    OBD_FAIL_CHECK(OBD_FAIL_MDS_CLIENT_ADD)) {
                         CERROR("no room for %u clients - fix LR_MAX_CLIENTS\n",
                                cl_idx);
                         return -EOVERFLOW;
index b05a9d3..0401d3f 100644 (file)
@@ -387,7 +387,7 @@ static int mds_create_objects(struct ptlrpc_request *req, int offset,
                 RETURN(rc);
         }
 
-        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_ALLOC_OBDO))
+        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_ALLOC_OBDO))
                 GOTO(out_ids, rc = -ENOMEM);
 
         OBDO_ALLOC(oinfo.oi_oa);
index f81d3ef..31ea904 100644 (file)
@@ -82,7 +82,7 @@ static struct llog_handle *llog_cat_new_log(struct llog_handle *cathandle)
                 RETURN(ERR_PTR(-ENOSPC));
         }
 
-        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
+        if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
                 RETURN(ERR_PTR(-ENOSPC));
 
         rc = llog_create(cathandle->lgh_ctxt, &loghandle, NULL, NULL);
index 894b20c..7113817 100644 (file)
@@ -1164,7 +1164,7 @@ static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
                 /* corrupt the data before we compute the checksum, to
                  * simulate an OST->client data error */
                 if (i == 0 && opc == OST_READ &&
-                    OBD_FAIL_CHECK_ONCE(OBD_FAIL_OSC_CHECKSUM_RECEIVE))
+                    OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_RECEIVE))
                         memcpy(ptr + off, "bad1", min(4, nob));
                 cksum = compute_checksum(cksum, ptr + off, count, cksum_type);
                 cfs_kunmap(pga[i]->pg);
@@ -1177,7 +1177,7 @@ static obd_count osc_checksum_bulk(int nob, obd_count pg_count,
         }
         /* For sending we only compute the wrong checksum instead
          * of corrupting the data so it is still correct on a redo */
-        if (opc == OST_WRITE && OBD_FAIL_CHECK_ONCE(OBD_FAIL_OSC_CHECKSUM_SEND))
+        if (opc == OST_WRITE && OBD_FAIL_CHECK(OBD_FAIL_OSC_CHECKSUM_SEND))
                 cksum++;
 
         return cksum;
index fcb1695..b6f2a77 100644 (file)
@@ -422,13 +422,13 @@ static __u32 ost_checksum_bulk(struct ptlrpc_bulk_desc *desc, int opc,
                 /* corrupt the data before we compute the checksum, to
                  * simulate a client->OST data error */
                 if (i == 0 && opc == OST_WRITE &&
-                    OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_CHECKSUM_RECEIVE))
+                    OBD_FAIL_CHECK(OBD_FAIL_OST_CHECKSUM_RECEIVE))
                         memcpy(ptr, "bad3", min(4, len));
                 cksum = compute_checksum(cksum, ptr, len, cksum_type);
                 /* corrupt the data after we compute the checksum, to
                  * simulate an OST->client data error */
                 if (i == 0 && opc == OST_READ &&
-                    OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_CHECKSUM_SEND)) {
+                    OBD_FAIL_CHECK(OBD_FAIL_OST_CHECKSUM_SEND)) {
                         memcpy(ptr, "bad4", min(4, len));
                         /* nobody should use corrupted page again */
                         ClearPageUptodate(page);
@@ -1830,14 +1830,14 @@ static int ost_handle(struct ptlrpc_request *req)
                 CDEBUG(D_INODE, "create\n");
                 OBD_FAIL_RETURN(OBD_FAIL_OST_CREATE_NET, 0);
                 OBD_FAIL_TIMEOUT_MS(OBD_FAIL_OST_PAUSE_CREATE, obd_fail_val);
-                if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_EROFS))
+                if (OBD_FAIL_CHECK(OBD_FAIL_OST_EROFS))
                         GOTO(out, rc = -EROFS);
                 rc = ost_create(req->rq_export, req, oti);
                 break;
         case OST_DESTROY:
                 CDEBUG(D_INODE, "destroy\n");
                 OBD_FAIL_RETURN(OBD_FAIL_OST_DESTROY_NET, 0);
-                if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_EROFS))
+                if (OBD_FAIL_CHECK(OBD_FAIL_OST_EROFS))
                         GOTO(out, rc = -EROFS);
                 rc = ost_destroy(req->rq_export, req, oti);
                 break;
@@ -1864,7 +1864,7 @@ static int ost_handle(struct ptlrpc_request *req)
                 OBD_FAIL_RETURN(OBD_FAIL_OST_BRW_NET, 0);
                 if (OBD_FAIL_CHECK(OBD_FAIL_OST_ENOSPC))
                         GOTO(out, rc = -ENOSPC);
-                if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_EROFS))
+                if (OBD_FAIL_CHECK(OBD_FAIL_OST_EROFS))
                         GOTO(out, rc = -EROFS);
                 rc = ost_brw_write(req, oti);
                 LASSERT(current->journal_info == NULL);
@@ -1888,7 +1888,7 @@ static int ost_handle(struct ptlrpc_request *req)
         case OST_PUNCH:
                 CDEBUG(D_INODE, "punch\n");
                 OBD_FAIL_RETURN(OBD_FAIL_OST_PUNCH_NET, 0);
-                if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_EROFS))
+                if (OBD_FAIL_CHECK(OBD_FAIL_OST_EROFS))
                         GOTO(out, rc = -EROFS);
                 rc = ost_punch(req->rq_export, req, oti);
                 break;
index 11cfd3b..cf5d752 100644 (file)
@@ -105,7 +105,7 @@ int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc)
         __u64                     xid;
         ENTRY;
 
-        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_BULK_PUT_NET))
+        if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_PUT_NET))
                 RETURN(0);
 
         /* NB no locking required until desc is on the network */
@@ -213,7 +213,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req)
         lnet_md_t         md;
         ENTRY;
 
-        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_BULK_GET_NET))
+        if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_GET_NET))
                 RETURN(0);
 
         /* NB no locking required until desc is on the network */
@@ -678,7 +678,7 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd)
         CDEBUG(D_NET, "LNetMEAttach: portal %d\n",
                service->srv_req_portal);
 
-        if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_PTLRPC_RQBD))
+        if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_RQBD))
                 return (-ENOMEM);
 
         rc = LNetMEAttach(service->srv_req_portal,
index beee1c1..6c2505e 100644 (file)
@@ -811,7 +811,7 @@ static int dqacq_interpret(struct ptlrpc_request *req, void *data, int rc)
         QDATA_DEBUG((&qunit->lq_data), "lq_data: \n");
 
         if (qdata->qd_id != qunit->lq_data.qd_id ||
-            OBD_FAIL_CHECK_ONCE(OBD_FAIL_QUOTA_RET_QDATA)) {
+            OBD_FAIL_CHECK(OBD_FAIL_QUOTA_RET_QDATA)) {
                 CERROR("the returned qd_id isn't expected!"
                        "(qdata: %u, lq_data: %u)\n", qdata->qd_id,
                        qunit->lq_data.qd_id);