diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
index 583988444f8c5a7e91f559ab59bb705efbf3f1fc..48da88286f8f4ea316f4b394c3762ddd98c9f3b7 100644
--- a/lustre/osc/osc_request.c
+++ b/lustre/osc/osc_request.c
@@ -626,6 +626,8 @@ static int osc_destroy(struct obd_export *exp, struct obdo *oa,
                 RETURN(-EINVAL);
         }
 
+        LASSERT(oa->o_id != 0);
+
         count = osc_resource_get_unused(exp, oa->o_id, &cancels, LCK_PW,
                                         LDLM_FL_DISCARD_DATA);
         if (exp_connect_cancelset(exp))
@@ -3371,6 +3373,10 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 if (!capable (CAP_SYS_ADMIN))
                         GOTO (out, err = -EPERM);
                 oa = &data->ioc_obdo1;
+
+                if (oa->o_id == 0)
+                        GOTO(out, err = -EINVAL);
+
                 oa->o_valid |= OBD_MD_FLGROUP;
 
                 err = osc_destroy(exp, oa, NULL, NULL, NULL);
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index 7e8960c2b334ce33bd63b6bd992e289c9bf263c6..e67da314d6d8cd81462158cd242a647f76a143bd 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -96,6 +96,9 @@ static int ost_destroy(struct obd_export *exp, struct ptlrpc_request *req,
         if (body == NULL)
                 RETURN(-EFAULT);
 
+        if (body->oa.o_id == 0)
+                RETURN(-EPROTO);
+
         if (lustre_msg_buflen(req->rq_reqmsg, REQ_REC_OFF + 1)) {
                 struct ldlm_request *dlm;
                 dlm = lustre_swab_reqbuf(req, REQ_REC_OFF + 1, sizeof(*dlm),
diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c
index 387897ecbad986d4baecd6faf0bf6adea88de17a..4b03997b9b5a3bd559673b4e6d4592d684955b89 100644
--- a/lustre/utils/obd.c
+++ b/lustre/utils/obd.c
@@ -1170,7 +1170,7 @@ int jt_obd_destroy(int argc, char **argv)
                 return CMD_HELP;
 
         id = strtoull(argv[1], &end, 0);
-        if (*end) {
+        if (*end || id == 0 || errno != 0) {
                 fprintf(stderr, "error: %s: invalid objid '%s'\n",
                         jt_cmdname(argv[0]), argv[1]);
                 return CMD_HELP;