* [PATCH v2] erofs-utils: xattr: skip xattrs with unidentified "system." prefix
@ 2023-04-20 9:27 Weizhao Ouyang
2023-04-20 9:36 ` Gao Xiang
0 siblings, 1 reply; 2+ messages in thread
From: Weizhao Ouyang @ 2023-04-20 9:27 UTC (permalink / raw)
To: Gao Xiang, linux-erofs; +Cc: Weizhao Ouyang
Skip xattrs with unidentified "system." prefix to avoid ENODATA error.
Such as building AOSP on NFSv4 servers.
Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
---
include/erofs/xattr.h | 6 ++++++
lib/xattr.c | 12 ++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/erofs/xattr.h b/include/erofs/xattr.h
index 9efadc5e5e80..de078a5eb08a 100644
--- a/include/erofs/xattr.h
+++ b/include/erofs/xattr.h
@@ -41,6 +41,12 @@ static inline unsigned int xattrblock_offset(unsigned int xattr_id)
(_size - sizeof(struct erofs_xattr_ibody_header)) / \
sizeof(struct erofs_xattr_entry) + 1; })
+#ifndef XATTR_SYSTEM_PREFIX
+#define XATTR_SYSTEM_PREFIX "system."
+#endif
+#ifndef XATTR_SYSTEM_PREFIX_LEN
+#define XATTR_SYSTEM_PREFIX_LEN (sizeof(XATTR_SYSTEM_PREFIX) - 1)
+#endif
#ifndef XATTR_USER_PREFIX
#define XATTR_USER_PREFIX "user."
#endif
diff --git a/lib/xattr.c b/lib/xattr.c
index 6034e7b6b4eb..7c776330bdaa 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -288,6 +288,18 @@ static bool erofs_is_skipped_xattr(const char *key)
if (cfg.sehnd && !strcmp(key, XATTR_SECURITY_PREFIX "selinux"))
return true;
#endif
+
+ /* skip xattrs with unidentified "system." prefix */
+ if (!strncmp(key, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) {
+ if (!strcmp(key, XATTR_NAME_POSIX_ACL_ACCESS) ||
+ !strcmp(key, XATTR_NAME_POSIX_ACL_DEFAULT)) {
+ return false;
+ } else {
+ erofs_warn("skip unidentified xattr: %s", key);
+ return true;
+ }
+ }
+
return false;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] erofs-utils: xattr: skip xattrs with unidentified "system." prefix
2023-04-20 9:27 [PATCH v2] erofs-utils: xattr: skip xattrs with unidentified "system." prefix Weizhao Ouyang
@ 2023-04-20 9:36 ` Gao Xiang
0 siblings, 0 replies; 2+ messages in thread
From: Gao Xiang @ 2023-04-20 9:36 UTC (permalink / raw)
To: Weizhao Ouyang, linux-erofs
On 2023/4/20 17:27, Weizhao Ouyang wrote:
> Skip xattrs with unidentified "system." prefix to avoid ENODATA error.
> Such as building AOSP on NFSv4 servers.
>
> Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Will apply, thanks!
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-20 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 9:27 [PATCH v2] erofs-utils: xattr: skip xattrs with unidentified "system." prefix Weizhao Ouyang
2023-04-20 9:36 ` Gao Xiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).