Whamcloud - gitweb
LU-14579 flr: mirror unlink and split race
[fs/lustre-release.git] / lustre / mdd / mdd_dir.c
index c0cbf55..2f69cc7 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/mdd/mdd_dir.c
  *
@@ -70,7 +69,7 @@ mdd_name_check(struct mdd_device *m, const struct lu_name *ln)
 static int
 __mdd_lookup(const struct lu_env *env, struct md_object *pobj,
             const struct lu_attr *pattr, const struct lu_name *lname,
-            struct lu_fid* fid, int mask)
+            struct lu_fid *fid, unsigned int may_mask)
 {
        const char *name = lname->ln_name;
        const struct dt_key *key = (const struct dt_key *)name;
@@ -92,7 +91,7 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj,
                       PFID(mdd_object_fid(mdd_obj)));
        }
 
-       rc = mdd_permission_internal_locked(env, mdd_obj, pattr, mask,
+       rc = mdd_permission_internal_locked(env, mdd_obj, pattr, may_mask,
                                            DT_TGT_PARENT);
        if (rc)
                RETURN(rc);
@@ -1792,7 +1791,7 @@ static int mdd_unlink(const struct lu_env *env, struct md_object *pobj,
 
        /* Enough for only unlink the entry */
        if (unlikely(mdd_cobj == NULL))
-               GOTO(stop, rc);
+               GOTO(cleanup, rc);
 
        if (cattr->la_nlink > 0 || mdd_cobj->mod_count > 0) {
                /* update ctime of an unlinked file only if it is still
@@ -2150,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)
@@ -2317,9 +2321,12 @@ static int mdd_acl_init(const struct lu_env *env, struct mdd_object *pobj,
                           XATTR_NAME_ACL_DEFAULT);
        mdd_read_unlock(env, pobj);
        if (rc > 0) {
+               /* ACL buffer size is not enough, need realloc */
+               if (rc > acl_buf->lb_len)
+                       RETURN(-ERANGE);
+
                /* If there are default ACL, fix mode/ACL by default ACL */
                def_acl_buf->lb_len = rc;
-               LASSERT(def_acl_buf->lb_len <= acl_buf->lb_len);
                memcpy(acl_buf->lb_buf, def_acl_buf->lb_buf, rc);
                acl_buf->lb_len = rc;
                rc = __mdd_fix_mode_acl(env, acl_buf, &la->la_mode);
@@ -4078,11 +4085,6 @@ static int mdd_migrate_cmd_check(struct mdd_device *mdd,
 {
        __u32 lum_stripe_count = lum->lum_stripe_count;
        __u32 lmv_hash_type = lmv->lmv_hash_type;
-       char *mdt_hash_name[] = { "none",
-                                 LMV_HASH_NAME_ALL_CHARS,
-                                 LMV_HASH_NAME_FNV_1A_64,
-                                 LMV_HASH_NAME_CRUSH,
-       };
 
        if (!lmv_is_sane(lmv))
                return -EBADF;