Thread (3 messages) 3 messages, 2 authors, 2021-03-05

Re: [PATCH 2/2] f2fs: fix error handling in f2fs_end_enable_verity()

From: Eric Biggers <ebiggers@kernel.org>
Date: 2021-03-05 04:52:47
Also in: linux-ext4, linux-f2fs-devel, linux-fscrypt

On Fri, Mar 05, 2021 at 09:37:26AM +0800, Chao Yu wrote:
quoted
+cleanup:
+	/*
+	 * Verity failed to be enabled, so clean up by truncating any verity
+	 * metadata that was written beyond i_size (both from cache and from
+	 * disk) and clearing FI_VERITY_IN_PROGRESS.
+	 */
+	truncate_inode_pages(inode->i_mapping, inode->i_size);
+	f2fs_truncate(inode);
Eric,

Truncation can fail due to a lot of reasons, if we fail in f2fs_truncate(),
do we need to at least print a message here? or it allows to keep those
meta/data silently.
I suppose we might as well, although hopefully there will already be a message
for the underlying failure reason too.  Also, f2fs_file_write_iter() has the
same issue too, right?
One other concern is that how do you think of covering truncate_inode_pages &
f2fs_truncate with F2FS_I(inode)->i_gc_rwsem[WRITE] lock to avoid racing with
GC, so that page cache won't be revalidated after truncate_inode_pages().
Yes, that does seem to be needed, due to the way the f2fs garbage collection
works.

- Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help