Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / mdd / mdd_object.c
index 56f595d..0cf918a 100644 (file)
@@ -67,6 +67,15 @@ static int mdd_xattr_get(const struct lu_env *env,
                          struct md_object *obj, struct lu_buf *buf,
                          const char *name);
 
+int mdd_data_get(const struct lu_env *env, struct mdd_object *obj,
+                 void **data)
+{
+        LASSERTF(mdd_object_exists(obj), "FID is "DFID"\n",
+                 PFID(mdd_object_fid(obj)));
+        mdo_data_get(env, obj, data);
+        return 0;
+}
+
 int mdd_la_get(const struct lu_env *env, struct mdd_object *obj,
                struct lu_attr *la, struct lustre_capa *capa)
 {
@@ -155,7 +164,11 @@ struct lu_buf *mdd_buf_alloc(const struct lu_env *env, ssize_t len)
         return buf;
 }
 
-/* preserve old data */
+/** Increase the size of the \a mti_big_buf.
+ * preserves old data in buffer
+ * old buffer remains unchanged on error
+ * \retval 0 or -ENOMEM
+ */
 int mdd_buf_grow(const struct lu_env *env, ssize_t len)
 {
         struct lu_buf *oldbuf = &mdd_env_info(env)->mti_big_buf;
@@ -423,12 +436,10 @@ static int mdd_path_current(const struct lu_env *env,
                 /* Get parent fid and object name */
                 mdd_read_lock(env, mdd_obj, MOR_TGT_CHILD);
                 buf = mdd_links_get(env, mdd_obj);
-                if (IS_ERR(buf))
-                        GOTO(out, rc = PTR_ERR(buf));
                 mdd_read_unlock(env, mdd_obj);
                 mdd_object_put(env, mdd_obj);
-                if (rc < 0)
-                        GOTO(out, rc);
+                if (IS_ERR(buf))
+                        GOTO(out, rc = PTR_ERR(buf));
 
                 leh = buf->lb_buf;
                 lee = (struct link_ea_entry *)(leh + 1); /* link #0 */
@@ -1246,14 +1257,17 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
                                         qnids[USRQUOTA], qnids[GRPQUOTA], 1,
                                         &inode_pending, NULL, 0, NULL, 0);
                         block_count = (la_tmp->la_blocks + 7) >> 3;
-                        if (block_count)
+                        if (block_count) {
+                                void *data = NULL;
+                                mdd_data_get(env, mdd_obj, &data);
                                 /* get block quota for new owner */
                                 lquota_chkquota(mds_quota_interface_ref, obd,
                                                 qnids[USRQUOTA],
                                                 qnids[GRPQUOTA],
                                                 block_count, &block_pending,
                                                 NULL, LQUOTA_FLAGS_BLK,
-                                                NULL, 0);
+                                                data, 1);
+                        }
                 }
         }
 #endif