]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bcachefs: setting bcachefs_effective.* xattrs is a noop
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 18 Aug 2024 17:24:26 +0000 (13:24 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 Aug 2024 06:07:22 +0000 (02:07 -0400)
bcachefs_effective.* xattrs show the options inherited from parent
directories (as well as explicitly set); this namespace is not for
setting bcachefs options.

Change the .set() handler to a noop so that if e.g. rsync is copying
xattrs it'll do the right thing, and only copy xattrs in the bcachefs.*
namespace. We don't want to return an error, because that will cause
rsync to bail out or get spammy.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/xattr.c

index f2b4c17a0307df035241ccaf7f581b4b2336b3d0..331f944d73dc930c0aae3cf0134aba6550fb633f 100644 (file)
@@ -612,10 +612,20 @@ static int bch2_xattr_bcachefs_get_effective(
                                         name, buffer, size, true);
 }
 
+/* Noop - xattrs in the bcachefs_effective namespace are inherited */
+static int bch2_xattr_bcachefs_set_effective(const struct xattr_handler *handler,
+                                  struct mnt_idmap *idmap,
+                                  struct dentry *dentry, struct inode *vinode,
+                                  const char *name, const void *value,
+                                  size_t size, int flags)
+{
+       return 0;
+}
+
 static const struct xattr_handler bch_xattr_bcachefs_effective_handler = {
        .prefix = "bcachefs_effective.",
        .get    = bch2_xattr_bcachefs_get_effective,
-       .set    = bch2_xattr_bcachefs_set,
+       .set    = bch2_xattr_bcachefs_set_effective,
 };
 
 #endif /* NO_BCACHEFS_FS */