Whamcloud - gitweb
LU-5710 all: second batch of corrected typos and grammar errors
[fs/lustre-release.git] / lustre / mdt / mdt_hsm_cdt_requests.c
index 3125dcc..36adeb1 100644 (file)
@@ -23,6 +23,7 @@
  * (C) Copyright 2012 Commissariat a l'energie atomique et aux energies
  *     alternatives
  *
+ * Copyright (c) 2014, Intel Corporation.
  */
 /*
  * lustre/mdt/mdt_hsm_cdt_requests.c
@@ -156,8 +157,13 @@ static int hsm_update_work(struct cdt_req_progress *crp,
        int                       rc, osz, nsz;
        struct interval_node    **new_vv;
        struct interval_node     *v, *node;
+       __u64                     end;
        ENTRY;
 
+       end = extent->offset + extent->length;
+       if (end <= extent->offset)
+               RETURN(-EINVAL);
+
        mutex_lock(&crp->crp_lock);
        /* new node index */
 
@@ -196,7 +202,7 @@ static int hsm_update_work(struct cdt_req_progress *crp,
 
        v = crp->crp_node[crp->crp_cnt / NODE_VECTOR_SZ];
        node = &v[crp->crp_cnt % NODE_VECTOR_SZ];
-       interval_set(node, extent->offset, extent->offset + extent->length);
+       interval_set(node, extent->offset, end);
        /* try to insert, if entry already exist ignore the new one
         * it can happen if ct sends 2 times the same progress */
        if (interval_insert(node, &crp->crp_root) == NULL)
@@ -205,7 +211,7 @@ static int hsm_update_work(struct cdt_req_progress *crp,
        rc = 0;
 out:
        mutex_unlock(&crp->crp_lock);
-       return rc;
+       RETURN(rc);
 }
 
 /**
@@ -219,7 +225,7 @@ static void mdt_cdt_init_request_tree(struct cdt_req_progress *crp)
        crp->crp_max = 0;
 }
 
-/** Allocate/init a agent request and its sub-structures.
+/** Allocate/init an agent request and its sub-structures.
  *
  * \param compound_id [IN]
  * \param archive_id [IN]
@@ -260,7 +266,7 @@ struct cdt_agent_req *mdt_cdt_alloc_request(__u64 compound_id, __u32 archive_id,
 }
 
 /**
- * Free a agent request and its sub-structures.
+ * Free an agent request and its sub-structures.
  *
  * \param car [IN]  Request to be freed.
  */