* [PATCH] f2fs: avoid stale fi->gdirty_list pointer
@ 2017-10-13 2:14 Jaegeuk Kim
2017-10-16 1:56 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2017-10-13 2:14 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim
When doing fault injection test, f2fs_evict_inode() didn't remove gdirty_list
which incurs a kernel panic due to wrong pointer access.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index f6db9d533ca4..1ae5396c97d6 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -535,6 +535,8 @@ void f2fs_evict_inode(struct inode *inode)
if (!is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
+ else
+ f2fs_inode_synced(inode);
/* ino == 0, if f2fs_new_inode() was failed t*/
if (inode->i_ino)
--
2.14.0.rc1.383.gd1ce394fe2-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: avoid stale fi->gdirty_list pointer
2017-10-13 2:14 [PATCH] f2fs: avoid stale fi->gdirty_list pointer Jaegeuk Kim
@ 2017-10-16 1:56 ` Chao Yu
2017-10-16 23:06 ` Jaegeuk Kim
0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2017-10-16 1:56 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-fsdevel, linux-f2fs-devel
On 2017/10/13 10:14, Jaegeuk Kim wrote:
> When doing fault injection test, f2fs_evict_inode() didn't remove gdirty_list
> which incurs a kernel panic due to wrong pointer access.
>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Minor thing, how about reverting judgment condition for readability?
if (is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
f2fs_inode_synced()
else
f2fs_bug_on()
Thanks,
> ---
> fs/f2fs/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index f6db9d533ca4..1ae5396c97d6 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -535,6 +535,8 @@ void f2fs_evict_inode(struct inode *inode)
>
> if (!is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
> f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
> + else
> + f2fs_inode_synced(inode);
>
> /* ino == 0, if f2fs_new_inode() was failed t*/
> if (inode->i_ino)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: avoid stale fi->gdirty_list pointer
2017-10-16 1:56 ` [f2fs-dev] " Chao Yu
@ 2017-10-16 23:06 ` Jaegeuk Kim
2017-10-17 13:15 ` Chao Yu
0 siblings, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2017-10-16 23:06 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel
On 10/16, Chao Yu wrote:
> On 2017/10/13 10:14, Jaegeuk Kim wrote:
> > When doing fault injection test, f2fs_evict_inode() didn't remove gdirty_list
> > which incurs a kernel panic due to wrong pointer access.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>
> Reviewed-by: Chao Yu <yuchao0@huawei.com>
>
> Minor thing, how about reverting judgment condition for readability?
>
> if (is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
> f2fs_inode_synced()
We don't need to expect such the errored corner case first. ;)
> else
> f2fs_bug_on()
>
> Thanks,
>
> > ---
> > fs/f2fs/inode.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> > index f6db9d533ca4..1ae5396c97d6 100644
> > --- a/fs/f2fs/inode.c
> > +++ b/fs/f2fs/inode.c
> > @@ -535,6 +535,8 @@ void f2fs_evict_inode(struct inode *inode)
> >
> > if (!is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
> > f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
> > + else
> > + f2fs_inode_synced(inode);
> >
> > /* ino == 0, if f2fs_new_inode() was failed t*/
> > if (inode->i_ino)
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: avoid stale fi->gdirty_list pointer
2017-10-16 23:06 ` Jaegeuk Kim
@ 2017-10-17 13:15 ` Chao Yu
2017-10-17 18:16 ` Jaegeuk Kim
0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2017-10-17 13:15 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel
On 2017/10/17 7:06, Jaegeuk Kim wrote:
> On 10/16, Chao Yu wrote:
>> On 2017/10/13 10:14, Jaegeuk Kim wrote:
>>> When doing fault injection test, f2fs_evict_inode() didn't remove gdirty_list
>>> which incurs a kernel panic due to wrong pointer access.
>>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>
>> Reviewed-by: Chao Yu <yuchao0@huawei.com>
>>
>> Minor thing, how about reverting judgment condition for readability?
>>
>> if (is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
>> f2fs_inode_synced()
>
> We don't need to expect such the errored corner case first. ;)
Alright, making compiler being aware of this by using {un,}likely? :)
Thanks,
>
>> else
>> f2fs_bug_on()
>>
>> Thanks,
>>
>>> ---
>>> fs/f2fs/inode.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>>> index f6db9d533ca4..1ae5396c97d6 100644
>>> --- a/fs/f2fs/inode.c
>>> +++ b/fs/f2fs/inode.c
>>> @@ -535,6 +535,8 @@ void f2fs_evict_inode(struct inode *inode)
>>>
>>> if (!is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
>>> f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
>>> + else
>>> + f2fs_inode_synced(inode);
>>>
>>> /* ino == 0, if f2fs_new_inode() was failed t*/
>>> if (inode->i_ino)
>>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: avoid stale fi->gdirty_list pointer
2017-10-17 13:15 ` Chao Yu
@ 2017-10-17 18:16 ` Jaegeuk Kim
0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2017-10-17 18:16 UTC (permalink / raw)
To: Chao Yu; +Cc: Chao Yu, linux-fsdevel, linux-kernel, linux-f2fs-devel
On 10/17, Chao Yu wrote:
> On 2017/10/17 7:06, Jaegeuk Kim wrote:
> > On 10/16, Chao Yu wrote:
> >> On 2017/10/13 10:14, Jaegeuk Kim wrote:
> >>> When doing fault injection test, f2fs_evict_inode() didn't remove gdirty_list
> >>> which incurs a kernel panic due to wrong pointer access.
> >>>
> >>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> >>
> >> Reviewed-by: Chao Yu <yuchao0@huawei.com>
> >>
> >> Minor thing, how about reverting judgment condition for readability?
> >>
> >> if (is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
> >> f2fs_inode_synced()
> >
> > We don't need to expect such the errored corner case first. ;)
>
> Alright, making compiler being aware of this by using {un,}likely? :)
Yup, added. ;)
>
> Thanks,
>
> >
> >> else
> >> f2fs_bug_on()
> >>
> >> Thanks,
> >>
> >>> ---
> >>> fs/f2fs/inode.c | 2 ++
> >>> 1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> >>> index f6db9d533ca4..1ae5396c97d6 100644
> >>> --- a/fs/f2fs/inode.c
> >>> +++ b/fs/f2fs/inode.c
> >>> @@ -535,6 +535,8 @@ void f2fs_evict_inode(struct inode *inode)
> >>>
> >>> if (!is_set_ckpt_flags(sbi, CP_ERROR_FLAG))
> >>> f2fs_bug_on(sbi, is_inode_flag_set(inode, FI_DIRTY_INODE));
> >>> + else
> >>> + f2fs_inode_synced(inode);
> >>>
> >>> /* ino == 0, if f2fs_new_inode() was failed t*/
> >>> if (inode->i_ino)
> >>>
> >
> > ------------------------------------------------------------------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-17 18:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 2:14 [PATCH] f2fs: avoid stale fi->gdirty_list pointer Jaegeuk Kim
2017-10-16 1:56 ` [f2fs-dev] " Chao Yu
2017-10-16 23:06 ` Jaegeuk Kim
2017-10-17 13:15 ` Chao Yu
2017-10-17 18:16 ` Jaegeuk Kim
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).