m0t1fs: fix getfattr -n pver on
When running st/m0t1fs_pool_version_assignment.sh:
/tmp/test_m0t1fs_08-04-2021_17:50:23/0:1000: pver: Operation not supported
As result, the ST is failing.
Solution: add xattr_handler for pver and fix checking the
xattr names at m0t1fs_setxattr / m0t1fs_getxattr().
@@ -335,6 +335,14 @@ int m0t1fs_setxattr(struct dentry *dentry, const char *name,
M0_THREAD_ENTER;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
+ /*
+ * XXX: this 'dirty hack' is for oostore objects whose xattr name
+ * is empty here (for some reason, I could not figure out why).
+ * In normal (non-oostore) mode it works fine even without this.
+ */
+ name = handler->name;
+#endif
M0_ENTRY("Setting %.*s's xattr %s=%.*s", dentry->d_name.len,
(char*)dentry->d_name.name, name, (int)size, (char *)value);
@@ -446,6 +454,10 @@ ssize_t m0t1fs_getxattr(struct dentry *dentry, const char *name,
struct m0_fop *rep_fop = NULL;
M0_THREAD_ENTER;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
+ /* XXX: see comment for the same code above at m0t1fs_setxattr(). */
+ name = handler->name;
+#endif
M0_ENTRY("Getting %.*s's xattr %s", dentry->d_name.len,
(char*)dentry->d_name.name, name);
rc = m0t1fs_fs_conf_lock(csb);
@@ -2484,6 +2496,12 @@ const struct xattr_handler m0t1fs_xattr_lid = {
.set = m0t1fs_setxattr,
};
+const struct xattr_handler m0t1fs_xattr_pver = {
+ .name = "pver",
+ .flags = 0,
+ .get = m0t1fs_getxattr,
+};
+
const struct xattr_handler m0t1fs_xattr_writesize = {
.name = "writesize",
.flags = 0,
@@ -2509,6 +2527,7 @@ const struct xattr_handler *m0t1fs_xattr_handlers[] = {
&m0t1fs_xattr_writesize,
&m0t1fs_xattr_fid_lid,
&m0t1fs_xattr_fid_writesize,
+ &m0t1fs_xattr_pver,
NULL
};
#endif
