[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6160a9a2-16b9-e37c-eabc-57f71a1932af@kernel.org>
Date: Tue, 14 Feb 2023 09:46:50 +0800
From: Chao Yu <chao@...nel.org>
To: Daeho Jeong <daeho43@...il.com>
Cc: linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, kernel-team@...roid.com,
Daeho Jeong <daehojeong@...gle.com>,
syzbot+823000d23b3400619f7c@...kaller.appspotmail.com
Subject: Re: [f2fs-dev] [PATCH] f2fs: synchronize atomic write aborts
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,
Powered by blists - more mailing lists