lkml.org 
[lkml]   [2023]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [f2fs-dev] [PATCH] f2fs: synchronize atomic write aborts
From
On 2023/2/14 4:14, Daeho Jeong wrote:
>>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>>> index 28c9c72dda2a..7bf660d4cad9 100644
>>> --- a/fs/f2fs/inode.c
>>> +++ b/fs/f2fs/inode.c
>>> @@ -777,11 +777,18 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
>>> void f2fs_evict_inode(struct inode *inode)
>>> {
>>> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
>>> - nid_t xnid = F2FS_I(inode)->i_xattr_nid;
>>> + struct f2fs_inode_info *fi = F2FS_I(inode);
>>> + nid_t xnid = fi->i_xattr_nid;
>>> int err = 0;
>>>
>>> f2fs_abort_atomic_write(inode, true);
>>>
>>> + if (fi->cow_inode) {
>>> + clear_inode_flag(fi->cow_inode, FI_COW_FILE);
>>> + iput(fi->cow_inode);
>>> + fi->cow_inode = NULL;
>>> + }
>>
>> It looks "fi->cow_inode = NULL" here may race w/ cow_inode allocation in
>> f2fs_ioc_start_atomic_write due to f2fs_write_inode() has not been covered
>> by inode_lock()? IIUC.
>
> Sorry, I couldn't understand it, since I couldn't find any relation
> between f2fs_ioc_start_atomic_write and f2fs_write_inode. Could you
> elaborate more on this? I thought the code might be safe, since it
> happens in the inode eviction phase.

int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
void f2fs_evict_inode(struct inode *inode)

Oops, it looks I was misled by f2fs_write_inode() above f2fs_evict_inode(),
please ignore my comments, sorry. :(

Thanks,

\
 
 \ /
  Last update: 2023-03-27 00:20    [W:0.053 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site