ecryptfs: remove the remaining struct page usage
Get series with b4
b4 am [email protected] change-id 20261014-ecryptfs-folio-67e80ccec7f3Versions newest first
- v3 Latest10 patches 0 repliesNew
- v29 patches 0 repliesSuperseded
- v17 patches 1 replySuperseded
Changes in v3 from the cover letter
- Patch 1 (new): Write from the right offset in ecryptfs_write_lower_page_segment().
- Patch 8: Skip zeroing the tail when the new size is page-aligned, per Sashiko.
- Link to v2: https://patch.msgid.link/[email protected]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | ecryptfs: write from the right offset in ecryptfs_write_lower_page_segment()fs/ | +1 | 0 replies | |
| 2/10 | ecryptfs: reject zero-length encrypted session keysfs/ | +2 | 0 replies | |
| 3/10 | ecryptfs: keep the folio locked while ecryptfs_write() writes it outfs/ | +3 | 0 replies | |
| 4/10 | ecryptfs: remove struct ecryptfs_page_crypt_contextfs/ | +0 | 0 replies | |
| 5/10 | ecryptfs: use a folio and a buffer in crypt_extent()fs/ | +20 | 0 replies | |
| 6/10 | ecryptfs: use kzalloc() for the header bufferfs/ | +3 | 0 replies | |
| 7/10 | ecryptfs: use sg_init_one() instead of virt_to_scatterlist()fs/ fs/ fs/ | +25 | 0 replies | |
| 8/10 | ecryptfs: zero the tail of the last folio in place on truncatefs/ | +42 | 0 replies | |
| 9/10 | ecryptfs: rename functions to refer to foliosfs/ fs/ fs/ +2 more | +32 | 0 replies | |
| 10/10 | ecryptfs: refer to folios in comments and printk stringsfs/ fs/ fs/ | +43 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 00/10] ecryptfs: remove the remaining struct page usage
Convert the page cache side of the encryption path to folios, and use plain kernel memory for the buffers that were only pages because of the old interfaces: the ciphertext block, the header buffer from ecryptfs_get_zeroed_pages(), and the scatterlists built by virt_to_scatterlist(). Also make a shrinking truncate zero the tail of the last folio in place, as other filesystems do, instead of copying from the zero page through the write path. After this, fs/ecryptfs has no struct page usage left.
Three related fixes come first. ecryptfs_write_lower_page_segment() now writes from the right offset in the folio, which matters when a truncate extends a file that is not encrypted. The packet parsers now reject a zero-length encrypted session key, which used to leave a file set up with an all-zero key. ecryptfs_write() keeps the folio locked until it has been written to the lower file.
Ran cleanly with fsx and fsstress on ecryptfs over ext4 in the default, xattr, and passthrough mount options.
---
Changes in v3:
- Patch 1 (new): Write from the right offset in ecryptfs_write_lower_page_segment().
- Patch 8: Skip zeroing the tail when the new size is page-aligned, per Sashiko.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Patch 1 (new): Reject zero-length encrypted session keys in the
tag 1 and tag 3 packet parsers, per Sashiko.
- Patch 2 (new): Keep the folio locked in ecryptfs_write() until it
has been written to the lower file, per Sashiko.
- Patch 7: Hold the folio lock while encrypting the zeroed tail and
mark the folio not uptodate if that fails, per Sashiko.
- Link to v1: https://patch.msgid.link/[email protected]
---
Tal Zussman (10):
ecryptfs: write from the right offset in ecryptfs_write_lower_page_segment()
ecryptfs: reject zero-length encrypted session keys
ecryptfs: keep the folio locked while ecryptfs_write() writes it out
ecryptfs: remove struct ecryptfs_page_crypt_context
ecryptfs: use a folio and a buffer in crypt_extent()
ecryptfs: use kzalloc() for the header buffer
ecryptfs: use sg_init_one() instead of virt_to_scatterlist()
ecryptfs: zero the tail of the last folio in place on truncate
ecryptfs: rename functions to refer to folios
ecryptfs: refer to folios in comments and printk strings
fs/ecryptfs/crypto.c | 145 ++++++++++++------------------------------ fs/ecryptfs/ecryptfs_kernel.h | 21 ++---- fs/ecryptfs/inode.c | 55 ++++++++++++---- fs/ecryptfs/keystore.c | 118 ++++++++-------------------------- fs/ecryptfs/mmap.c | 60 +++++++++-------- fs/ecryptfs/read_write.c | 54 ++++++++-------- 6 files changed, 169 insertions(+), 284 deletions(-)
---
base-commit: 8f6626bd6594a78f454d02b27b74a580c890cab9
change-id: 20261014-ecryptfs-folio-67e80ccec7f3
Best regards,
Signature · 1 line
Tal Zussman <[email protected]>