Whamcloud - gitweb
LU-14430 mdd: don't assert on default ACL big buffer 75/41775/6
authorMikhail Pershin <mpershin@whamcloud.com>
Fri, 26 Feb 2021 14:48:36 +0000 (17:48 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Mar 2021 18:34:10 +0000 (18:34 +0000)
Previous patch may cause situations when default ACL buffer
is bigger than ACL buffer, so that default ACL EA may fit
into the former but not in the latter, causing assertion in
mdd_acl_init().

There is no need in assertion actually, just return -ERANGE so
ACL buffer will be re-allocated.

Fixes: f3d03bc38a3a ("LU-14430 mdd: fix inheritance of big default ACLs")
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Change-Id: I8c0665ba693c60506812926a8372b61095d08f78
Reviewed-on: https://review.whamcloud.com/41775
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/mdd/mdd_dir.c

index 6060b1f..9c57a46 100644 (file)
@@ -2317,9 +2317,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) {
                           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;
                /* 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);
                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);