diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-12 16:12:27 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-13 11:34:39 -0400 |
commit | 77cbc731b2a05ef0a5f9f02293c1de40c1ca594f (patch) | |
tree | 1e54d877212481d7414f06fec74a7515334f21d4 | |
parent | 2bdf81a6a42dbd51395c0ce3a9101584fc147dab (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>
-rw-r--r-- | fs/bcachefs/fs-common.c | 5 |
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); |