Whamcloud - gitweb
Revert "b=22244 ldlm cancel flags cleanup"
authorJohann Lombardi <johann@sun.com>
Mon, 31 May 2010 23:20:28 +0000 (01:20 +0200)
committerJohann Lombardi <johann@sun.com>
Mon, 31 May 2010 23:20:28 +0000 (01:20 +0200)
This reverts commit 80786e8223938e1f3379ba409dec61a15dd2fc60.
Reverting all patches from 22244 & 21128 because of test failures.
See 22244 for more info.

lustre/include/lustre_dlm.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/ldlm/ldlm_internal.h
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_request.c
lustre/lov/lov_obd.c
lustre/osc/osc_request.c
lustre/tests/it_test.c
lustre/utils/loadgen.c

index ca3f9c0..3939a23 100644 (file)
@@ -103,7 +103,7 @@ typedef enum {
 #define LDLM_FL_REPLAY         0x000100
 
 #define LDLM_FL_INTENT_ONLY    0x000200 /* don't grant lock, just do intent */
-#define LDLM_FL_LOCAL_ONLY     0x000400
+#define LDLM_FL_LOCAL_ONLY     0x000400 /* see ldlm_cli_cancel_unused */
 
 /* don't run the cancel callback under ldlm_cli_cancel_unused */
 #define LDLM_FL_FAILED         0x000800
@@ -111,7 +111,7 @@ typedef enum {
 #define LDLM_FL_HAS_INTENT     0x001000 /* lock request has intent */
 #define LDLM_FL_CANCELING      0x002000 /* lock cancel has already been sent */
 #define LDLM_FL_LOCAL          0x004000 /* local lock (ie, no srv/cli split) */
-/* was LDLM_FL_WARN  until 1.8.4  0x008000 */
+#define LDLM_FL_WARN           0x008000 /* see ldlm_cli_cancel_unused */
 #define LDLM_FL_DISCARD_DATA   0x010000 /* discard (no writeback) on cancel */
 
 #define LDLM_FL_NO_TIMEOUT     0x020000 /* Blocked by group lock - wait
@@ -499,14 +499,6 @@ struct ldlm_interval_tree {
         struct interval_node *lit_root; /* actually ldlm_interval */
 };
 
-/* Cancel flag. */
-typedef enum {
-        /* LCF_ASYNC = 0x1 is used in 2.0 to cancel locks asynchronously. */
-        LCF_LOCAL      = 0x2, /* Cancel locks locally, not notifing server */
-        LCF_BL_AST     = 0x4, /* Cancel locks marked as LDLM_FL_BL_AST
-                               * in the same RPC */
-} ldlm_cancel_flags_t;
-
 struct ldlm_lock {
         struct portals_handle l_handle; // must be first in the structure
         atomic_t              l_refc;
@@ -886,15 +878,14 @@ int ldlm_cli_convert(struct lustre_handle *, int new_mode, __u32 *flags);
 int ldlm_cli_update_pool(struct ptlrpc_request *req);
 int ldlm_cli_cancel(struct lustre_handle *lockh);
 int ldlm_cli_cancel_unused(struct ldlm_namespace *, struct ldlm_res_id *,
-                           ldlm_cancel_flags_t flags, void *opaque);
+                           int flags, void *opaque);
 int ldlm_cli_cancel_req(struct obd_export *exp,
                         struct list_head *head, int count);
 int ldlm_cli_join_lru(struct ldlm_namespace *, struct ldlm_res_id *, int join);
 int ldlm_cancel_resource_local(struct ldlm_resource *res,
                                struct list_head *cancels,
-                               ldlm_policy_data_t *policy,
-                               ldlm_mode_t mode, int lock_flags,
-                               ldlm_cancel_flags_t cancel_flags, void *opaque);
+                               ldlm_policy_data_t *policy, ldlm_mode_t mode,
+                               int lock_flags, int cancel_flags, void *opaque);
 int ldlm_cli_cancel_list(struct list_head *head, int count,
                          struct ptlrpc_request *req, int off);
 
index d7d1ec5..7574479 100644 (file)
@@ -1276,7 +1276,7 @@ struct obd_ops {
                         __u32 mode, struct lustre_handle *, int flags,
                         obd_off end);
         int (*o_cancel_unused)(struct obd_export *, struct lov_stripe_md *,
-                               ldlm_cancel_flags_t flags, void *opaque);
+                               int flags, void *opaque);
         int (*o_join_lru)(struct obd_export *, struct lov_stripe_md *,
                          int join);
         int (*o_init_export)(struct obd_export *exp);
index 09aa5bf..58d0912 100644 (file)
@@ -1454,8 +1454,7 @@ static inline int obd_cancel(struct obd_export *exp, struct lov_stripe_md *ea,
 }
 
 static inline int obd_cancel_unused(struct obd_export *exp,
-                                    struct lov_stripe_md *ea,
-                                    ldlm_cancel_flags_t flags,
+                                    struct lov_stripe_md *ea, int flags,
                                     void *opaque)
 {
         int rc;
index 4925c78..12dc18c 100644 (file)
@@ -78,9 +78,8 @@ enum {
 
 int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, ldlm_sync_t sync,
                     int flags);
-int ldlm_cancel_lru_local(struct ldlm_namespace *ns,
-                          struct list_head *cancels, int count, int max,
-                          ldlm_cancel_flags_t cancel_flags, int flags);
+int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
+                          int count, int max, int cancel_flags, int flags);
 extern int ldlm_enqueue_min;
 int ldlm_get_enq_timeout(struct ldlm_lock *lock);
 
index e491fb3..039de76 100644 (file)
@@ -491,7 +491,8 @@ int client_disconnect_export(struct obd_export *exp)
         if (obd->obd_namespace != NULL) {
                 /* obd_force == local only */
                 ldlm_cli_cancel_unused(obd->obd_namespace, NULL,
-                                       obd->obd_force ? LCF_LOCAL : 0, NULL);
+                                       obd->obd_force ? LDLM_FL_LOCAL_ONLY:0,
+                                       NULL);
                 ldlm_namespace_free_prior(obd->obd_namespace, imp,
                                           obd->obd_force);
         }
index 88500d5..b92c925 100644 (file)
@@ -1128,7 +1128,7 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
                 flags = ns_connect_lru_resize(ns) ?
                         LDLM_CANCEL_LRUR : LDLM_CANCEL_AGED;
                 count += ldlm_cancel_lru_local(ns, &cancels, 0, avail - 1,
-                                               LCF_BL_AST, flags);
+                                               LDLM_FL_BL_AST, flags);
         }
         ldlm_cli_cancel_list(&cancels, count, NULL, 0);
         RETURN(0);
@@ -1136,8 +1136,7 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
 
 /* XXX until we will have compound requests and can cut cancels from generic rpc
  * we need send cancels with LDLM_FL_BL_AST flag as separate rpc */
-static int ldlm_cancel_list(struct list_head *cancels, int count,
-                            ldlm_cancel_flags_t flags)
+static int ldlm_cancel_list(struct list_head *cancels, int count, int flags)
 {
         CFS_LIST_HEAD(head);
         struct ldlm_lock *lock, *next;
@@ -1148,13 +1147,13 @@ static int ldlm_cancel_list(struct list_head *cancels, int count,
                 if (left-- == 0)
                         break;
 
-                if (flags & LCF_LOCAL) {
+                if (flags & LDLM_FL_LOCAL_ONLY) {
                         rc = LDLM_FL_LOCAL_ONLY;
                         ldlm_lock_cancel(lock);
                 } else {
                         rc = ldlm_cli_cancel_local(lock);
                 }
-                if (!(flags & LCF_BL_AST) && (rc == LDLM_FL_BL_AST)) {
+                if (!(flags & LDLM_FL_BL_AST) && (rc == LDLM_FL_BL_AST)) {
                         LDLM_DEBUG(lock, "Cancel lock separately");
                         list_del_init(&lock->l_bl_ast);
                         list_add(&lock->l_bl_ast, &head);
@@ -1338,8 +1337,7 @@ ldlm_cancel_lru_policy(struct ldlm_namespace *ns, int flags)
  *                               outstanding rpc to complete
  */
 int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
-                          int count, int max, ldlm_cancel_flags_t cancel_flags,
-                          int flags)
+                          int count, int max, int cancel_flags, int flags)
 {
         ldlm_cancel_lru_policy_t pf;
         struct ldlm_lock *lock, *next;
@@ -1494,7 +1492,7 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res,
                                struct list_head *cancels,
                                ldlm_policy_data_t *policy,
                                ldlm_mode_t mode, int lock_flags,
-                               ldlm_cancel_flags_t cancel_flags, void *opaque)
+                               int cancel_flags, void *opaque)
 {
         struct ldlm_lock *lock;
         int count = 0;
@@ -1509,8 +1507,13 @@ int ldlm_cancel_resource_local(struct ldlm_resource *res,
                         continue;
                 }
 
-                if (lock->l_readers || lock->l_writers)
+                if (lock->l_readers || lock->l_writers) {
+                        if (cancel_flags & LDLM_FL_WARN) {
+                                LDLM_ERROR(lock, "lock in use");
+                                //LBUG();
+                        }
                         continue;
+                }
 
                 /* If somebody is already doing CANCEL, or blocking ast came,
                  * skip this lock. */
@@ -1589,8 +1592,7 @@ int ldlm_cli_cancel_list(struct list_head *cancels, int count,
 
 static int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
                                            struct ldlm_res_id res_id,
-                                           ldlm_cancel_flags_t flags,
-                                           void *opaque)
+                                           int flags, void *opaque)
 {
         struct ldlm_resource *res;
         CFS_LIST_HEAD(cancels);
@@ -1630,11 +1632,10 @@ static inline int have_no_nsresource(struct ldlm_namespace *ns)
 /* Cancel all locks on a namespace (or a specific resource, if given)
  * that have 0 readers/writers.
  *
- * If flags & LCF_LOCAL, throw the locks away without trying
+ * If flags & LDLM_FL_LOCAL_ONLY, throw the locks away without trying
  * to notify the server. */
 int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
-                           struct ldlm_res_id *res_id,
-                           ldlm_cancel_flags_t flags, void *opaque)
+                           struct ldlm_res_id *res_id, int flags, void *opaque)
 {
         int i;
         ENTRY;
index d86a4ba..ecabebb 100644 (file)
@@ -2331,8 +2331,7 @@ static int lov_cancel(struct obd_export *exp, struct lov_stripe_md *lsm,
 }
 
 static int lov_cancel_unused(struct obd_export *exp,
-                             struct lov_stripe_md *lsm,
-                             ldlm_cancel_flags_t flags, void *opaque)
+                             struct lov_stripe_md *lsm, int flags, void *opaque)
 {
         struct lov_obd *lov;
         struct lov_oinfo *loi;
index a4f6abd..44adfc0 100644 (file)
@@ -3573,9 +3573,7 @@ static int osc_cancel(struct obd_export *exp, struct lov_stripe_md *md,
 }
 
 static int osc_cancel_unused(struct obd_export *exp,
-                             struct lov_stripe_md *lsm,
-                             ldlm_cancel_flags_t flags,
-                             void *opaque)
+                             struct lov_stripe_md *lsm, int flags, void *opaque)
 {
         struct obd_device *obd = class_exp2obd(exp);
         struct ldlm_res_id res_id, *resp = NULL;
index f846a17..a2997a7 100644 (file)
@@ -243,9 +243,8 @@ static enum interval_iter sanity_cb(struct interval_node *node, void *args)
         }
 
         if (!has) {
-                int count;
+                int count = 1;
 err:
-                count = 1;
                 dprintf("node"__S":%llu Child list:\n",
                         node->in_extent.start,
                         node->in_extent.end,
index 73b5a9c..ec84295 100644 (file)
@@ -669,7 +669,7 @@ static void *run_one_child(void *threadvp)
 {
         struct kid_t *kid;
         char oname[10], ename[10];
-        int thread = (long)threadvp, dev = 0;
+        int thread = (long)threadvp, dev;
         int rc = 0, err;
 
         if (o_verbose > 2)