Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

coda: change locking order in coda_file_write_iter()

The coda host file is a backing file for the coda inode on a different
filesystem than the coda inode.

Change the locking order to take the coda inode lock before taking
the backing host file freeze protection, same as in ovl_write_iter()
and in network filesystems that use cachefiles.

Link: https://lore.kernel.org/r/CAOQ4uxjcnwuF1gMxe64WLODGA_MyAy8x-DtqkCUxqVQKk3Xbng@mail.gmail.com/
Acked-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/r/20231122122715.2561213-10-amir73il@gmail.com
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Amir Goldstein and committed by
Christian Brauner
e389b76a 2f4d8ad8

+2 -2
+2 -2
fs/coda/file.c
··· 79 79 if (ret) 80 80 goto finish_write; 81 81 82 - file_start_write(host_file); 83 82 inode_lock(coda_inode); 83 + file_start_write(host_file); 84 84 ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, 0); 85 85 coda_inode->i_size = file_inode(host_file)->i_size; 86 86 coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; 87 87 inode_set_mtime_to_ts(coda_inode, inode_set_ctime_current(coda_inode)); 88 - inode_unlock(coda_inode); 89 88 file_end_write(host_file); 89 + inode_unlock(coda_inode); 90 90 91 91 finish_write: 92 92 venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode),