From b66b530c18c910ded562e279c9db02fcdad42176 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Fri, 26 Feb 2021 17:48:36 +0300 Subject: [PATCH] LU-14430 mdd: don't assert on default ACL big buffer 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 Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Change-Id: I8c0665ba693c60506812926a8372b61095d08f78 Reviewed-on: https://review.whamcloud.com/41775 Tested-by: jenkins Tested-by: Maloo --- lustre/mdd/mdd_dir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 6060b1f..9c57a46 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -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) { + /* 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); -- 1.8.3.1