summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-common.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-12 16:12:27 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:43 -0400
commitbf9cb250edf776454d0600b4341c6667974bedb8 (patch)
tree49979a158d3d2af3f4ea81b826e25355bdc39829 /fs/bcachefs/fs-common.c
parentf866870f5dbe9c9fb745f5a24bb30b6477ec619a (diff)
bcachefs: Don't allow hardlinks when inherited attrs would change
This is the right thing to do, and conforms with our own behaviour on rename and xfs's behaviour on hardlink. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fs-common.c')
-rw-r--r--fs/bcachefs/fs-common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/fs-common.c b/fs/bcachefs/fs-common.c
index 53ffc684223c..e9dd1d13ec7e 100644
--- a/fs/bcachefs/fs-common.c
+++ b/fs/bcachefs/fs-common.c
@@ -212,6 +212,11 @@ int bch2_link_trans(struct btree_trans *trans,
if (ret)
goto err;
+ if (bch2_reinherit_attrs(inode_u, dir_u)) {
+ ret = -EXDEV;
+ goto err;
+ }
+
dir_u->bi_mtime = dir_u->bi_ctime = now;
dir_hash = bch2_hash_info_init(c, dir_u);