2019-07-31 23:57:31 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
2020-07-13 15:09:44 +02:00
|
|
|
|
2021-08-20 18:00:19 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2018-07-26 20:21:52 +08:00
|
|
|
|
2025-09-23 15:01:12 +08:00
|
|
|
|
2018-07-26 20:21:55 +08:00
|
|
|
|
|
|
|
|
|
2026-02-03 10:31:00 +08:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
2026-02-03 10:31:00 +08:00
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2026-02-03 10:31:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
2019-09-04 10:08:56 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2025-07-14 17:09:06 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2021-03-29 08:36:14 +08:00
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
2021-03-29 08:36:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
2019-09-04 10:09:09 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-02 12:00:14 +08:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
|
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2025-07-14 17:09:06 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2023-07-05 15:01:04 -04:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2019-09-04 10:08:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
2019-09-04 10:09:09 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
2024-09-12 16:35:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-28 11:54:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
erofs: separate plain and compressed filesystems formally
The EROFS on-disk format uses a tiny, plain metadata design that
prioritizes performance and minimizes complex inconsistencies against
common writable disk filesystems (almost all serious metadata
inconsistency cannot happen in well-designed immutable filesystems like
EROFS). EROFS deliberately avoids artificial design flaws to eliminate
serious security risks from untrusted remote sources by design,
although human-made implementation bugs can still happen sometimes.
Currently, there is no strict check to prevent compressed inodes,
especially LZ4-compressed inodes, from being read in plain filesystems.
Starting with erofs-utils 1.0 and Linux 5.3, LZ4_0PADDING sb feature
is automatically enabled for LZ4-compressed EROFS images to support
in-place decompression. Furthermore, since Linux 5.4 LTS is no longer
supported, we no longer need to handle ancient LZ4-compressed EROFS
images generated by erofs-utils prior to 1.0.
To formally distinguish different filesystem types for improved
security:
- Use the presence of LZ4_0PADDING or a non-zero
`dsb->u1.lz4_max_distance` as a marker for compressed filesystems
containing LZ4-compressed inodes only;
- For other algorithms, use `dsb->u1.available_compr_algs` bitmap.
Note: LZ4_0PADDING has been supported since Linux 5.4 (the first formal
kernel version), so exposing it via sysfs is no longer necessary and is
now deprecated (but remain it for five more years until 2031):
`dsb->u1` has been strictly non-zero for all EROFS images containing
compressed inodes starting with erofs-utils v1.3 and it is actually
a much better marker for compressed filesystems.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-01-29 10:41:25 +08:00
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
erofs: separate plain and compressed filesystems formally
The EROFS on-disk format uses a tiny, plain metadata design that
prioritizes performance and minimizes complex inconsistencies against
common writable disk filesystems (almost all serious metadata
inconsistency cannot happen in well-designed immutable filesystems like
EROFS). EROFS deliberately avoids artificial design flaws to eliminate
serious security risks from untrusted remote sources by design,
although human-made implementation bugs can still happen sometimes.
Currently, there is no strict check to prevent compressed inodes,
especially LZ4-compressed inodes, from being read in plain filesystems.
Starting with erofs-utils 1.0 and Linux 5.3, LZ4_0PADDING sb feature
is automatically enabled for LZ4-compressed EROFS images to support
in-place decompression. Furthermore, since Linux 5.4 LTS is no longer
supported, we no longer need to handle ancient LZ4-compressed EROFS
images generated by erofs-utils prior to 1.0.
To formally distinguish different filesystem types for improved
security:
- Use the presence of LZ4_0PADDING or a non-zero
`dsb->u1.lz4_max_distance` as a marker for compressed filesystems
containing LZ4-compressed inodes only;
- For other algorithms, use `dsb->u1.available_compr_algs` bitmap.
Note: LZ4_0PADDING has been supported since Linux 5.4 (the first formal
kernel version), so exposing it via sysfs is no longer necessary and is
now deprecated (but remain it for five more years until 2031):
`dsb->u1` has been strictly non-zero for all EROFS images containing
compressed inodes starting with erofs-utils v1.3 and it is actually
a much better marker for compressed filesystems.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-01-29 10:41:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
2025-03-10 17:54:54 +08:00
|
|
|
|
2021-09-22 17:51:41 +08:00
|
|
|
|
2023-11-09 19:18:22 +08:00
|
|
|
|
2021-08-20 18:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-13 21:53:08 +08:00
|
|
|
|
2021-08-20 18:00:19 +08:00
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
|
|
|
|
|
2020-11-01 03:51:02 +08:00
|
|
|
|
2021-08-05 08:36:00 +08:00
|
|
|
|
2021-10-07 15:02:23 +08:00
|
|
|
|
2023-07-11 14:21:30 +08:00
|
|
|
|
|
|
|
|
|
2021-08-05 08:36:00 +08:00
|
|
|
|
2020-07-30 01:58:01 +08:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
2022-09-27 14:36:07 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
erofs: allow sharing page cache with the same aops only
Inode with identical data but different @aops cannot be mixed
because the page cache is managed by different subsystems (e.g.,
@aops for compressed on-disk inodes cannot handle plain on-disk
inodes).
In this patch, we never allow inodes to share the page cache
among plain, compressed, and fileio cases. When a shared inode
is created, we initialize @aops that is the same as the initial
real inode, and subsequent inodes cannot share the page cache
if the inferred @aops differ from the corresponding shared inode.
This is reasonable as a first step because, in typical use cases,
if an inode is compressible, it will fall into compressed
inodes across different filesystem images unless users use plain
filesystems. However, in that cases, users will use plain
filesystems all the time.
Fixes: 5ef3208e3be5 ("erofs: introduce the page cache share feature")
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-02-14 03:02:48 +00:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2022-09-27 14:36:07 +08:00
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2019-09-04 10:09:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-23 01:31:30 +00:00
|
|
|
|
|
|
|
|
|
2019-09-04 10:09:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-18 18:53:13 +08:00
|
|
|
|
2019-09-04 10:09:08 +08:00
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-04 10:09:08 +08:00
|
|
|
|
|
|
|
|
|
2025-03-10 17:54:52 +08:00
|
|
|
|
2019-09-04 10:09:08 +08:00
|
|
|
|
|
|
|
|
|
2024-09-02 17:34:12 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
2024-08-19 10:52:07 +08:00
|
|
|
|
erofs: allow sharing page cache with the same aops only
Inode with identical data but different @aops cannot be mixed
because the page cache is managed by different subsystems (e.g.,
@aops for compressed on-disk inodes cannot handle plain on-disk
inodes).
In this patch, we never allow inodes to share the page cache
among plain, compressed, and fileio cases. When a shared inode
is created, we initialize @aops that is the same as the initial
real inode, and subsequent inodes cannot share the page cache
if the inferred @aops differ from the corresponding shared inode.
This is reasonable as a first step because, in typical use cases,
if an inode is compressible, it will fall into compressed
inodes across different filesystem images unless users use plain
filesystems. However, in that cases, users will use plain
filesystems all the time.
Fixes: 5ef3208e3be5 ("erofs: introduce the page cache share feature")
Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-02-14 03:02:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
|
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
|
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
|
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-27 14:36:07 +08:00
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
2022-09-27 14:36:07 +08:00
|
|
|
|
2018-10-09 22:07:13 +08:00
|
|
|
|
2025-07-22 08:32:29 +08:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2019-08-30 00:38:27 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
Coccinelle-based conversion to use ->i_state accessors
All places were patched by coccinelle with the default expecting that
->i_lock is held, afterwards entries got fixed up by hand to use
unlocked variants as needed.
The script:
@@
expression inode, flags;
@@
- inode->i_state & flags
+ inode_state_read(inode) & flags
@@
expression inode, flags;
@@
- inode->i_state &= ~flags
+ inode_state_clear(inode, flags)
@@
expression inode, flag1, flag2;
@@
- inode->i_state &= ~flag1 & ~flag2
+ inode_state_clear(inode, flag1 | flag2)
@@
expression inode, flags;
@@
- inode->i_state |= flags
+ inode_state_set(inode, flags)
@@
expression inode, flags;
@@
- inode->i_state = flags
+ inode_state_assign(inode, flags)
@@
expression inode, flags;
@@
- flags = inode->i_state
+ flags = inode_state_read(inode)
@@
expression inode, flags;
@@
- READ_ONCE(inode->i_state) & flags
+ inode_state_read(inode) & flags
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-10-09 09:59:18 +02:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2019-03-09 14:08:53 -03:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
2023-01-13 14:52:25 +08:00
|
|
|
|
2018-07-26 20:21:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-13 12:49:12 +01:00
|
|
|
|
2021-01-21 14:19:43 +01:00
|
|
|
|
|
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
|
|
|
|
|
2024-11-15 15:46:25 +08:00
|
|
|
|
2024-07-18 16:32:43 +08:00
|
|
|
|
|
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
2024-07-18 16:32:43 +08:00
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-18 16:32:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-15 15:46:25 +08:00
|
|
|
|
|
|
|
|
|
2024-07-18 16:32:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-15 15:46:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-18 16:32:43 +08:00
|
|
|
|
|
|
|
|
|
2023-08-07 15:38:33 -04:00
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-23 15:01:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-04-01 14:13:42 +08:00
|
|
|
|
2025-09-23 15:01:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-14 19:40:24 +08:00
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
2018-07-26 20:21:52 +08:00
|
|
|
|
2022-09-22 17:17:00 +02:00
|
|
|
|
2021-08-13 13:29:31 +08:00
|
|
|
|
2019-01-14 19:40:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
2019-01-14 19:40:24 +08:00
|
|
|
|
2022-09-22 17:17:00 +02:00
|
|
|
|
2019-01-14 19:40:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-28 11:19:42 +08:00
|
|
|
|
2019-01-14 19:40:24 +08:00
|
|
|
|
2022-09-22 17:17:00 +02:00
|
|
|
|
2019-01-14 19:40:24 +08:00
|
|
|
|