summaryrefslogtreecommitdiff
path: root/libbcachefs/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/xattr.c')
-rw-r--r--libbcachefs/xattr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libbcachefs/xattr.c b/libbcachefs/xattr.c
index 725a6f3e..21f64cb7 100644
--- a/libbcachefs/xattr.c
+++ b/libbcachefs/xattr.c
@@ -511,7 +511,11 @@ static int bch2_xattr_bcachefs_set(const struct xattr_handler *handler,
mutex_lock(&inode->ei_update_lock);
if (inode_opt_id == Inode_opt_project) {
- ret = bch2_set_projid(c, inode, s.v);
+ /*
+ * inode fields accessible via the xattr interface are stored
+ * with a +1 bias, so that 0 means unset:
+ */
+ ret = bch2_set_projid(c, inode, s.v ? s.v - 1 : 0);
if (ret)
goto err;
}