/* fid_be_cpu(), fid_cpu_to_be(). */
#include <lustre_fid.h>
#include <obd_lov.h>
-
+#include <lustre_idmap.h>
#include <lustre_param.h>
#include <lustre_mds.h>
#include <lustre/lustre_idl.h>
if (IS_ERR(handle))
RETURN(PTR_ERR(handle));
- rc = mdd_declare_xattr_set(env, mdd, mdd_obj, buf, name, 0, handle);
+ rc = mdd_declare_xattr_set(env, mdd, mdd_obj, buf, name, fl, handle);
if (rc)
GOTO(stop, rc);
repeat:
rc = mdo_xattr_get(env, obj, buf, XATTR_NAME_LOV,
mdd_object_capa(env, obj));
+
+ if (rc == -ERANGE) {
+ /* mti_big_buf is allocated but is too small
+ * we need to increase it */
+ buf = lu_buf_check_and_alloc(&mdd_env_info(env)->mti_big_buf,
+ buf->lb_len * 2);
+ if (buf->lb_buf == NULL)
+ GOTO(out, rc = -ENOMEM);
+ goto repeat;
+ }
+
if (rc < 0)
GOTO(out, rc);
/* we have to sort the 2 obj, so locking will always
* be in the same order, even in case of 2 concurrent swaps */
rc = lu_fid_cmp(mdo2fid(md2mdd_obj(obj1)),
- mdo2fid(md2mdd_obj(obj2)));
+ mdo2fid(md2mdd_obj(obj2)));
/* same fid ? */
if (rc == 0)
RETURN(-EPERM);