Whamcloud - gitweb
LU-14579 flr: mirror unlink and split race
[fs/lustre-release.git] / lustre / mdd / mdd_dir.c
index fe0c927..2f69cc7 100644 (file)
@@ -1739,17 +1739,17 @@ static int mdd_unlink(const struct lu_env *env, struct md_object *pobj,
        if (IS_ERR(handle))
                RETURN(PTR_ERR(handle));
 
-       if (likely(mdd_cobj != NULL))
-               mdd_write_lock(env, mdd_cobj, DT_TGT_CHILD);
-
        rc = mdd_declare_unlink(env, mdd, mdd_pobj, mdd_cobj,
                                lname, ma, handle, no_name, is_dir);
        if (rc)
-               GOTO(cleanup, rc);
+               GOTO(stop, rc);
 
        rc = mdd_trans_start(env, mdd, handle);
        if (rc)
-               GOTO(cleanup, rc);
+               GOTO(stop, rc);
+
+       if (likely(mdd_cobj != NULL))
+               mdd_write_lock(env, mdd_cobj, DT_TGT_CHILD);
 
        if (likely(no_name == 0) && !OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DANGLING2)) {
                rc = __mdd_index_delete(env, mdd_pobj, name, is_dir, handle);
@@ -1840,6 +1840,7 @@ cleanup:
                        lname, NULL, handle);
        }
 
+stop:
        rc = mdd_trans_stop(env, mdd, rc, handle);
 
        return rc;
@@ -2148,6 +2149,11 @@ static int mdd_declare_create_object(const struct lu_env *env,
        const struct lu_buf *buf;
        int rc;
 
+#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
+       /* ldiskfs OSD needs this information for credit allocation */
+       if (def_acl_buf)
+               hint->dah_acl_len = def_acl_buf->lb_len;
+#endif
        rc = mdd_declare_create_object_internal(env, p, c, attr, handle, spec,
                                                hint);
        if (rc)