diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-08-24 21:57:48 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:44 +0300 |
commit | 7af0cec3076886d16114f4ca9794dfba3674794e (patch) | |
tree | 4b852054b0663e91328861142f151eecfb221cf2 /fs/bcachefs/xattr.c | |
parent | ac7eef0318c34c87e7ef9d574175917de1817ae6 (diff) | |
download | linux-7af0cec3076886d16114f4ca9794dfba3674794e.tar.xz |
bcachefs: Some project id fixes
Inode options that are accessible via the xattr interface are stored
with a +1 bias, so that a value of 0 means unset. We weren't handling
this consistently.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/xattr.c')
-rw-r--r-- | fs/bcachefs/xattr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/xattr.c b/fs/bcachefs/xattr.c index 806a638508a6..c7840bb949a1 100644 --- a/fs/bcachefs/xattr.c +++ b/fs/bcachefs/xattr.c @@ -513,7 +513,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; } |