Whamcloud - gitweb
LU-17662 osd-zfs: Support for ZFS 2.2.3
[fs/lustre-release.git] / lustre / mgc / mgc_request.c
index 7c2c27d..ad194a2 100644 (file)
@@ -206,23 +206,25 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd,
 {
        struct config_llog_data *cld;
        int rc;
+       int logname_size;
 
        ENTRY;
 
        CDEBUG(D_MGC, "do adding config log %s-%016lx\n", logname,
               cfg ? cfg->cfg_instance : 0);
 
-       OBD_ALLOC(cld, sizeof(*cld) + strlen(logname) + 1);
+       logname_size = strlen(logname) + 1;
+       OBD_ALLOC(cld, sizeof(*cld) + logname_size);
        if (!cld)
                RETURN(ERR_PTR(-ENOMEM));
 
        rc = mgc_logname2resid(logname, &cld->cld_resid, type);
        if (rc) {
-               OBD_FREE(cld, sizeof(*cld) + strlen(cld->cld_logname) + 1);
+               OBD_FREE(cld, sizeof(*cld) + logname_size);
                RETURN(ERR_PTR(rc));
        }
 
-       strcpy(cld->cld_logname, logname);
+       strscpy(cld->cld_logname, logname, logname_size);
        if (cfg)
                cld->cld_cfg = *cfg;
        else
@@ -1012,7 +1014,7 @@ static int mgc_enqueue(struct obd_export *exp, enum ldlm_type type,
        /* A failed enqueue should still call the mgc_blocking_ast,
         * where it will be requeued if needed ("grant failed").
         */
-       ptlrpc_req_finished(req);
+       ptlrpc_req_put(req);
        RETURN(rc);
 }
 
@@ -1609,7 +1611,7 @@ again:
 
 out:
        if (req) {
-               ptlrpc_req_finished(req);
+               ptlrpc_req_put(req);
                req = NULL;
        }