Whamcloud - gitweb
- Adds an int 'local_only' to the cancel_unused function and methods.
authorpschwan <pschwan>
Tue, 24 Sep 2002 16:24:45 +0000 (16:24 +0000)
committerpschwan <pschwan>
Tue, 24 Sep 2002 16:24:45 +0000 (16:24 +0000)
  Pass in a non-zero value to cancel the locks locally without notifying the
  server.  Used in recovery.
- Documentation update for the same.

lustre/include/linux/lustre_dlm.h
lustre/include/linux/obd.h
lustre/include/linux/obd_class.h
lustre/ldlm/ldlm_request.c
lustre/llite/file.c
lustre/lov/lov_obd.c
lustre/osc/osc_request.c

index ad6a93c..41116b4 100644 (file)
@@ -368,7 +368,7 @@ int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *new,
                     void *data, __u32 data_len);
 int ldlm_cli_convert(struct lustre_handle *, int new_mode, int *flags);
 int ldlm_cli_cancel(struct lustre_handle *lockh);
-int ldlm_cli_cancel_unused(struct ldlm_namespace *ns, __u64 *res_id);
+int ldlm_cli_cancel_unused(struct ldlm_namespace *, __u64 *, int local_only);
 
 /* mds/handler.c */
 /* This has to be here because recurisve inclusion sucks. */
index 7547394..25fb414 100644 (file)
@@ -300,7 +300,8 @@ struct obd_ops {
                          struct lustre_handle *lockh);
         int (*o_cancel)(struct lustre_handle *, struct lov_stripe_md *md,
                         __u32 mode, struct lustre_handle *);
-        int (*o_cancel_unused)(struct lustre_handle *, struct lov_stripe_md *);
+        int (*o_cancel_unused)(struct lustre_handle *, struct lov_stripe_md *,
+                               int local_only);
 };
 
 static inline void *mds_fs_start(struct mds_obd *mds, struct inode *inode,
index fa4fc4b..dc2f71c 100644 (file)
@@ -408,14 +408,14 @@ static inline int obd_cancel(struct lustre_handle *conn,
 }
 
 static inline int obd_cancel_unused(struct lustre_handle *conn,
-                                    struct lov_stripe_md *lsm)
+                                    struct lov_stripe_md *lsm, int local)
 {
         int rc;
         struct obd_export *export;
         OBD_CHECK_SETUP(conn, export);
         OBD_CHECK_OP(export->exp_obd, cancel_unused);
 
-        rc = OBP(export->exp_obd, cancel_unused)(conn, lsm);
+        rc = OBP(export->exp_obd, cancel_unused)(conn, lsm, local);
         RETURN(rc);
 }
 
index e273834..bdde5c4 100644 (file)
@@ -400,8 +400,12 @@ int ldlm_cli_cancel(struct lustre_handle *lockh)
         return rc;
 }
 
-/* Cancel all locks on a given resource that have 0 readers/writers */
-int ldlm_cli_cancel_unused(struct ldlm_namespace *ns, __u64 *res_id)
+/* Cancel all locks on a given resource that have 0 readers/writers.
+ *
+ * If 'local_only' is true, throw the locks away without trying to notify the
+ * server. */
+int ldlm_cli_cancel_unused(struct ldlm_namespace *ns, __u64 *res_id,
+                           int local_only)
 {
         struct ldlm_resource *res;
         struct list_head *tmp, *next, list = LIST_HEAD_INIT(list);
@@ -440,11 +444,14 @@ int ldlm_cli_cancel_unused(struct ldlm_namespace *ns, __u64 *res_id)
                 int rc;
                 w = list_entry(tmp, struct ldlm_ast_work, w_list);
 
-                ldlm_lock2handle(w->w_lock, &lockh);
-                rc = ldlm_cli_cancel(&lockh);
-                if (rc != ELDLM_OK)
-                        CERROR("ldlm_cli_cancel: %d\n", rc);
-
+                if (local_only)
+                        ldlm_lock_cancel(w->w_lock);
+                else {
+                        ldlm_lock2handle(w->w_lock, &lockh);
+                        rc = ldlm_cli_cancel(&lockh);
+                        if (rc != ELDLM_OK)
+                                CERROR("ldlm_cli_cancel: %d\n", rc);
+                }
                 LDLM_LOCK_PUT(w->w_lock);
                 list_del(&w->w_list);
                 OBD_FREE(w, sizeof(*w));
index 44ac03f..d86b313 100644 (file)
@@ -294,7 +294,7 @@ static int ll_file_release(struct inode *inode, struct file *file)
         }
         ptlrpc_req_finished(fd->fd_req);
 
-        rc = obd_cancel_unused(ll_i2obdconn(inode), lli->lli_smd);
+        rc = obd_cancel_unused(ll_i2obdconn(inode), lli->lli_smd, 0);
         if (rc)
                 CERROR("obd_cancel_unused: %d\n", rc);
 
index f7b9248..aa8bdb3 100644 (file)
@@ -868,7 +868,7 @@ static int lov_cancel(struct lustre_handle *conn, struct lov_stripe_md *lsm,
 }
 
 static int lov_cancel_unused(struct lustre_handle *conn,
-                             struct lov_stripe_md *lsm)
+                             struct lov_stripe_md *lsm, int local_only)
 {
         struct obd_export *export = class_conn2export(conn);
         struct lov_obd *lov;
@@ -892,7 +892,7 @@ static int lov_cancel_unused(struct lustre_handle *conn,
                 submd.lsm_mds_easize = lov_mds_md_size(lsm->lsm_ost_count);
                 submd.lsm_stripe_count = 0;
                 rc = obd_cancel_unused(&lov->tgts[loi->loi_ost_idx].conn,
-                                       &submd);
+                                       &submd, local_only);
                 if (rc)
                         CERROR("Error cancel unused objid "LPX64" subobj "LPX64
                                " on OST idx %d: rc = %d\n", lsm->lsm_object_id,
index a4e1a18..ef67119 100644 (file)
@@ -682,12 +682,12 @@ static int osc_cancel(struct lustre_handle *oconn, struct lov_stripe_md *md,
 }
 
 static int osc_cancel_unused(struct lustre_handle *connh,
-                             struct lov_stripe_md *lsm)
+                             struct lov_stripe_md *lsm, int local)
 {
         struct obd_device *obddev = class_conn2obd(connh);
         __u64 res_id[RES_NAME_SIZE] = { lsm->lsm_object_id };
 
-        return ldlm_cli_cancel_unused(obddev->obd_namespace, res_id);
+        return ldlm_cli_cancel_unused(obddev->obd_namespace, res_id, local);
 }
 
 static int osc_statfs(struct lustre_handle *conn, struct obd_statfs *osfs)