verity.c (87a0b2fafc09766d8c55461a18345a1cfb10a7fe) verity.c (e4544b63a7ee49e7fbebf35ece0a6acd3b9617ae)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/verity.c: fs-verity support for f2fs
4 *
5 * Copyright 2019 Google LLC
6 */
7
8/*

--- 194 unchanged lines hidden (view full) ---

203 * Verity failed to be enabled, so clean up by truncating any verity
204 * metadata that was written beyond i_size (both from cache and from
205 * disk) and clearing FI_VERITY_IN_PROGRESS.
206 *
207 * Taking i_gc_rwsem[WRITE] is needed to stop f2fs garbage collection
208 * from re-instantiating cached pages we are truncating (since unlike
209 * normal file accesses, garbage collection isn't limited by i_size).
210 */
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/verity.c: fs-verity support for f2fs
4 *
5 * Copyright 2019 Google LLC
6 */
7
8/*

--- 194 unchanged lines hidden (view full) ---

203 * Verity failed to be enabled, so clean up by truncating any verity
204 * metadata that was written beyond i_size (both from cache and from
205 * disk) and clearing FI_VERITY_IN_PROGRESS.
206 *
207 * Taking i_gc_rwsem[WRITE] is needed to stop f2fs garbage collection
208 * from re-instantiating cached pages we are truncating (since unlike
209 * normal file accesses, garbage collection isn't limited by i_size).
210 */
211 down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
211 f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
212 truncate_inode_pages(inode->i_mapping, inode->i_size);
213 err2 = f2fs_truncate(inode);
214 if (err2) {
215 f2fs_err(sbi, "Truncating verity metadata failed (errno=%d)",
216 err2);
217 set_sbi_flag(sbi, SBI_NEED_FSCK);
218 }
212 truncate_inode_pages(inode->i_mapping, inode->i_size);
213 err2 = f2fs_truncate(inode);
214 if (err2) {
215 f2fs_err(sbi, "Truncating verity metadata failed (errno=%d)",
216 err2);
217 set_sbi_flag(sbi, SBI_NEED_FSCK);
218 }
219 up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
219 f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
220 clear_inode_flag(inode, FI_VERITY_IN_PROGRESS);
221 return err ?: err2;
222}
223
224static int f2fs_get_verity_descriptor(struct inode *inode, void *buf,
225 size_t buf_size)
226{
227 struct fsverity_descriptor_location dloc;

--- 67 unchanged lines hidden ---
220 clear_inode_flag(inode, FI_VERITY_IN_PROGRESS);
221 return err ?: err2;
222}
223
224static int f2fs_get_verity_descriptor(struct inode *inode, void *buf,
225 size_t buf_size)
226{
227 struct fsverity_descriptor_location dloc;

--- 67 unchanged lines hidden ---