* [PATCH] coda: change locking order in coda_file_write_iter()
@ 2023-11-20 9:51 Amir Goldstein
2023-11-20 14:13 ` Jan Harkes
0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2023-11-20 9:51 UTC (permalink / raw)
To: Jan Harkes
Cc: Christian Brauner, Al Viro, Jan Kara, Jens Axboe, Miklos Szeredi,
David Howells, linux-fsdevel
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/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
Hi Jan,
Can you please ack this patch so that I can add it to my series
and send to Christian?
Thanks,
Amir.
fs/coda/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 16acc58311ea..e62315c37386 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -79,14 +79,14 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
if (ret)
goto finish_write;
- file_start_write(host_file);
inode_lock(coda_inode);
+ file_start_write(host_file);
ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, 0);
coda_inode->i_size = file_inode(host_file)->i_size;
coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
inode_set_mtime_to_ts(coda_inode, inode_set_ctime_current(coda_inode));
- inode_unlock(coda_inode);
file_end_write(host_file);
+ inode_unlock(coda_inode);
finish_write:
venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode),
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] coda: change locking order in coda_file_write_iter()
2023-11-20 9:51 [PATCH] coda: change locking order in coda_file_write_iter() Amir Goldstein
@ 2023-11-20 14:13 ` Jan Harkes
0 siblings, 0 replies; 2+ messages in thread
From: Jan Harkes @ 2023-11-20 14:13 UTC (permalink / raw)
To: Amir Goldstein
Cc: Christian Brauner, Al Viro, Jan Kara, Jens Axboe, Miklos Szeredi,
David Howells, linux-fsdevel
On Mon, Nov 20, 2023 at 11:51:10AM +0200, Amir Goldstein wrote:
> 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/
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Jan Harkes <jaharkes@cs.cmu.edu
Looks good, it makes sense to use the same lock ordering as the other
file systems. Thanks for pushing this along.
Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-20 14:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 9:51 [PATCH] coda: change locking order in coda_file_write_iter() Amir Goldstein
2023-11-20 14:13 ` Jan Harkes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).