Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / osd / osd_handler.c
index ea283e2..8361deb 100644 (file)
@@ -2166,7 +2166,10 @@ static int osd_index_compat_insert(const struct lu_env *env,
         if (osd_object_auth(env, dt, capa, CAPA_OPC_INDEX_INSERT))
                 return -EACCES;
 
-        fid_unpack(pack, fid);
+        result = fid_unpack(pack, fid);
+        if (result != 0)
+                return result;
+
         luch = lu_object_find(env, ludev->ld_site, fid);
         if (!IS_ERR(luch)) {
                 if (lu_object_exists(luch)) {
@@ -2204,16 +2207,8 @@ static struct dt_index_operations osd_index_compat_ops = {
 /*
  * OSD device type methods
  */
-static int osd_type_init(struct lu_device_type *t)
-{
-        LU_CONTEXT_KEY_INIT(&osd_key);
-        return lu_context_key_register(&osd_key);
-}
-
-static void osd_type_fini(struct lu_device_type *t)
-{
-        lu_context_key_degister(&osd_key);
-}
+LU_TYPE_INIT_FINI(osd, &osd_key);
 
 static struct lu_context_key osd_key = {
         .lct_tags = LCT_DT_THREAD | LCT_MD_THREAD,
@@ -2235,12 +2230,7 @@ static void *osd_key_init(const struct lu_context *ctx,
         return info;
 }
 
-static void osd_key_fini(const struct lu_context *ctx,
-                         struct lu_context_key *key, void *data)
-{
-        struct osd_thread_info *info = data;
-        OBD_FREE_PTR(info);
-}
+LU_KEY_FINI(osd, struct osd_thread_info);
 
 static void osd_key_exit(const struct lu_context *ctx,
                          struct lu_context_key *key, void *data)