From nobody Sat Feb 7 08:23:40 2026 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A0C923B632 for ; Wed, 28 Jan 2026 14:04:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.97 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769609098; cv=none; b=DJTmmn9Y8rLwlHbTePvUZVKCYBam2bWHyld5aeZTgnwGxI1S4qxpC5j7p2e+T8h9lk3FaMfX8JNuj/bWa84ACQlrMML2q7af0TrChLIc4h5vDybvp0h+QjerTnzRS5goB1OTsAZe8NgeMDCFWJhJ+gXWt0C3IrHKEcH2dHo1GUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769609098; c=relaxed/simple; bh=7rnCZxE1BbfHrghemwzp+MKkKloRtYATvUvYIVHVVs4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NuaKSu8igBFkQNqbIRltnYyb2XIRdkuu/hDBLAbDoT68yCcD6KJ0u2GmxtfI2I58CKZiSH2+zzLWUGuXydnsyljhNS/pPYzB5u7ujoUJkkpOgNtH2y3O292CGGOxCxHqr+zaJlGlUGNP6Bytki5AUcSNHwStXk0POnUJ+R5hJmE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=ItKuFQxy; arc=none smtp.client-ip=115.124.30.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="ItKuFQxy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1769609092; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=kXKOD/xgSXxZoa8bZ3p44g7V6hlanhsk+ei2kBRi79Y=; b=ItKuFQxyEmZiBUC8JQ9sqWyM4HOwnIjlvkA8Hj7b/AsKtqSUxaO2f5j/7pQTIl0XgcEQ3QJJYd27Hy8d96sADrMdhwTdj+PBz9+c3V44Y1icwVX+OS+DdlG57/qCOMhHzM23HL4LKZQDLUBhJfH6fc//D6Yl+xGmgxxu6ykUfrI= Received: from x31i01179.sqa.na131.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Wy3hRYw_1769609087 cluster:ay36) by smtp.aliyun-inc.com; Wed, 28 Jan 2026 22:04:52 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , oliver.yang@linux.alibaba.com, Gao Xiang , Hongbo Li Subject: [PATCH v2] erofs: mark inodes without acls in erofs_read_inode() Date: Wed, 28 Jan 2026 22:04:46 +0800 Message-ID: <20260128140446.2993210-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260128035408.2172802-1-hsiangkao@linux.alibaba.com> References: <20260128035408.2172802-1-hsiangkao@linux.alibaba.com> Precedence: list Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Similar to commit 91ef18b567da ("ext4: mark inodes without acls in __ext4_iget()"), the ACL state won't be read when the file owner performs a lookup, and the RCU fast path for lookups won't work because the ACL state remains unknown. If there are no extended attributes, or if the xattr filter indicates that no ACL xattr is present, call cache_no_acl() directly. Reviewed-by: Hongbo Li Signed-off-by: Gao Xiang --- v2: - use `le32_to_cpu` for `ih->h_name_filter`. fs/erofs/inode.c | 5 +++++ fs/erofs/xattr.c | 20 ++++++++++++++++++++ fs/erofs/xattr.h | 1 + 3 files changed, 26 insertions(+) diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index bce98c845a18..2e02d4b466ce 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -137,6 +137,11 @@ static int erofs_read_inode(struct inode *inode) err =3D -EFSCORRUPTED; goto err_out; } + + if (IS_ENABLED(CONFIG_EROFS_FS_POSIX_ACL) && + erofs_inode_has_noacl(inode, ptr, ofs)) + cache_no_acl(inode); + switch (inode->i_mode & S_IFMT) { case S_IFDIR: vi->dot_omitted =3D (ifmt >> EROFS_I_DOT_OMITTED_BIT) & 1; diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c index 512b998bdfff..14d22adc1476 100644 --- a/fs/erofs/xattr.c +++ b/fs/erofs/xattr.c @@ -574,4 +574,24 @@ struct posix_acl *erofs_get_acl(struct inode *inode, i= nt type, bool rcu) kfree(value); return acl; } + +bool erofs_inode_has_noacl(struct inode *inode, void *kaddr, unsigned int = ofs) +{ + static const unsigned int bitmask =3D + BIT(21) | /* system.posix_acl_default */ + BIT(30); /* system.posix_acl_access */ + struct erofs_sb_info *sbi =3D EROFS_I_SB(inode); + const struct erofs_xattr_ibody_header *ih =3D kaddr + ofs; + + if (EROFS_I(inode)->xattr_isize < sizeof(*ih)) + return true; + + if (erofs_sb_has_xattr_filter(sbi) && !sbi->xattr_filter_reserved && + !check_add_overflow(ofs, sizeof(*ih), &ofs) && + ofs <=3D i_blocksize(inode)) { + if ((le32_to_cpu(ih->h_name_filter) & bitmask) =3D=3D bitmask) + return true; + } + return false; +} #endif diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h index 36f2667afc2d..a3ceefa1554d 100644 --- a/fs/erofs/xattr.h +++ b/fs/erofs/xattr.h @@ -30,4 +30,5 @@ struct posix_acl *erofs_get_acl(struct inode *inode, int = type, bool rcu); #define erofs_get_acl (NULL) #endif =20 +bool erofs_inode_has_noacl(struct inode *inode, void *kaddr, unsigned int = ofs); #endif --=20 2.43.5