Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / osd / osd_handler.c
index ccf33ee..8361deb 100644 (file)
@@ -656,7 +656,7 @@ static struct thandle *osd_trans_start(const struct lu_env *env,
                 RETURN(ERR_PTR(hook_res));
 
         if (osd_param_is_sane(dev, p)) {
-                OBD_ALLOC_GFP(oh, sizeof *oh, GFP_NOFS);
+                OBD_ALLOC_GFP(oh, sizeof *oh, CFS_ALLOC_IO);
                 if (oh != NULL) {
                         /*
                          * XXX temporary stuff. Some abstraction layer should
@@ -1063,8 +1063,10 @@ static void osd_inode_setattr(const struct lu_env *env,
                 inode->i_ctime  = *osd_inode_time(env, inode, attr->la_ctime);
         if (bits & LA_MTIME)
                 inode->i_mtime  = *osd_inode_time(env, inode, attr->la_mtime);
-        if (bits & LA_SIZE)
-                LDISKFS_I(inode)->i_disksize = inode->i_size = attr->la_size;
+        if (bits & LA_SIZE) {
+                LDISKFS_I(inode)->i_disksize = attr->la_size;
+                i_size_write(inode, attr->la_size);
+        }
         if (bits & LA_BLOCKS)
                 inode->i_blocks = attr->la_blocks;
         if (bits & LA_MODE)
@@ -1490,7 +1492,7 @@ static int osd_xattr_del(const struct lu_env *env,
 static struct obd_capa *osd_capa_get(const struct lu_env *env,
                                      struct dt_object *dt,
                                      struct lustre_capa *old,
-                                     __u32 uid, __u64 opc)
+                                     __u64 opc)
 {
         struct osd_thread_info *info = osd_oti_get(env);
         const struct lu_fid *fid = lu_object_fid(&dt->do_lu);
@@ -1514,7 +1516,7 @@ static struct obd_capa *osd_capa_get(const struct lu_env *env,
 
         capa->lc_fid = *fid;
         capa->lc_opc = opc;
-        capa->lc_uid = uid;
+        capa->lc_uid = 0;
         capa->lc_flags = dev->od_capa_alg << 24;
         capa->lc_timeout = dev->od_capa_timeout;
         capa->lc_expiry = 0;
@@ -2164,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)) {
@@ -2202,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,
@@ -2233,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)
@@ -2487,7 +2479,7 @@ static void osd_inode_getattr(const struct lu_env *env,
         attr->la_mtime      = LTIME_S(inode->i_mtime);
         attr->la_ctime      = LTIME_S(inode->i_ctime);
         attr->la_mode       = inode->i_mode;
-        attr->la_size       = inode->i_size;
+        attr->la_size       = i_size_read(inode);
         attr->la_blocks     = inode->i_blocks;
         attr->la_uid        = inode->i_uid;
         attr->la_gid        = inode->i_gid;