* [PATCH] ext4: call fallocate may cause process to hang when using fast commit
@ 2021-12-16 8:03 Xin Yin
2021-12-17 20:17 ` harshad shirwadkar
0 siblings, 1 reply; 4+ messages in thread
From: Xin Yin @ 2021-12-16 8:03 UTC (permalink / raw)
To: harshadshirwadkar, tytso, adilger.kernel
Cc: linux-ext4, linux-kernel, Xin Yin
If open a file with O_SYNC, and call fallocate with mode=0.when using
fast commit, will cause the process to hang.
During the fast_commit procedure, it will wait for inode update done.
call ext4_fc_stop_update() before ext4_fc_commit() to mark inode
complete update.
Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
---
fs/ext4/extents.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 4108896d471b..92db33887b6c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4707,8 +4707,12 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
goto out;
if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
+ ext4_fc_stop_update(inode);
ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal,
EXT4_I(inode)->i_sync_tid);
+ inode_unlock(inode);
+ trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
+ return ret;
}
out:
inode_unlock(inode);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: call fallocate may cause process to hang when using fast commit
2021-12-16 8:03 [PATCH] ext4: call fallocate may cause process to hang when using fast commit Xin Yin
@ 2021-12-17 20:17 ` harshad shirwadkar
2021-12-23 2:44 ` harshad shirwadkar
0 siblings, 1 reply; 4+ messages in thread
From: harshad shirwadkar @ 2021-12-17 20:17 UTC (permalink / raw)
To: Xin Yin
Cc: Theodore Y. Ts'o, Andreas Dilger, Ext4 Developers List, linux-kernel
Thanks for the patch Xin, it looks good to me. I think there are a few
other places where we are not stopping the transaction before calling
commit. I'm trying to find them out.
Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
On Thu, Dec 16, 2021 at 12:04 AM Xin Yin <yinxin.x@bytedance.com> wrote:
>
> If open a file with O_SYNC, and call fallocate with mode=0.when using
> fast commit, will cause the process to hang.
>
> During the fast_commit procedure, it will wait for inode update done.
> call ext4_fc_stop_update() before ext4_fc_commit() to mark inode
> complete update.
>
> Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
> ---
> fs/ext4/extents.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 4108896d471b..92db33887b6c 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4707,8 +4707,12 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
> goto out;
>
> if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
> + ext4_fc_stop_update(inode);
> ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal,
> EXT4_I(inode)->i_sync_tid);
> + inode_unlock(inode);
> + trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
> + return ret;
> }
> out:
> inode_unlock(inode);
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: call fallocate may cause process to hang when using fast commit
2021-12-17 20:17 ` harshad shirwadkar
@ 2021-12-23 2:44 ` harshad shirwadkar
2021-12-23 3:32 ` [External] " Xin Yin
0 siblings, 1 reply; 4+ messages in thread
From: harshad shirwadkar @ 2021-12-23 2:44 UTC (permalink / raw)
To: Xin Yin
Cc: Theodore Y. Ts'o, Andreas Dilger, Ext4 Developers List, linux-kernel
Once the patch series "ext4 fast commit API cleanup" gets merged in
(https://patchwork.ozlabs.org/project/linux-ext4/list/?series=277672),
this patch won't be required anymore. So, I'll undo my review in favor
of merging the API cleanup patch series first.
- Harshad
On Fri, Dec 17, 2021 at 12:17 PM harshad shirwadkar
<harshadshirwadkar@gmail.com> wrote:
>
> Thanks for the patch Xin, it looks good to me. I think there are a few
> other places where we are not stopping the transaction before calling
> commit. I'm trying to find them out.
>
> Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
>
> On Thu, Dec 16, 2021 at 12:04 AM Xin Yin <yinxin.x@bytedance.com> wrote:
> >
> > If open a file with O_SYNC, and call fallocate with mode=0.when using
> > fast commit, will cause the process to hang.
> >
> > During the fast_commit procedure, it will wait for inode update done.
> > call ext4_fc_stop_update() before ext4_fc_commit() to mark inode
> > complete update.
> >
> > Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
> > ---
> > fs/ext4/extents.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> > index 4108896d471b..92db33887b6c 100644
> > --- a/fs/ext4/extents.c
> > +++ b/fs/ext4/extents.c
> > @@ -4707,8 +4707,12 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
> > goto out;
> >
> > if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
> > + ext4_fc_stop_update(inode);
> > ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal,
> > EXT4_I(inode)->i_sync_tid);
> > + inode_unlock(inode);
> > + trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
> > + return ret;
> > }
> > out:
> > inode_unlock(inode);
> > --
> > 2.20.1
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [External] Re: [PATCH] ext4: call fallocate may cause process to hang when using fast commit
2021-12-23 2:44 ` harshad shirwadkar
@ 2021-12-23 3:32 ` Xin Yin
0 siblings, 0 replies; 4+ messages in thread
From: Xin Yin @ 2021-12-23 3:32 UTC (permalink / raw)
To: harshad shirwadkar
Cc: Theodore Y. Ts'o, Andreas Dilger, Ext4 Developers List, linux-kernel
After applying Harshad's patch series "ext4 fast commit API cleanup" ,
this issue has been fixed.
So , please ignore this patch.
Thank,
Xin Yin
>On Thu, Dec 23, 2021 at 10:44 AM harshad shirwadkar <harshadshirwadkar@gmail.com> wrote:
>
> Once the patch series "ext4 fast commit API cleanup" gets merged in
> (https://patchwork.ozlabs.org/project/linux-ext4/list/?series=277672),
> this patch won't be required anymore. So, I'll undo my review in favor
> of merging the API cleanup patch series first.
>
> - Harshad
>
> On Fri, Dec 17, 2021 at 12:17 PM harshad shirwadkar
> <harshadshirwadkar@gmail.com> wrote:
> >
> > Thanks for the patch Xin, it looks good to me. I think there are a few
> > other places where we are not stopping the transaction before calling
> > commit. I'm trying to find them out.
> >
> > Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
> >
> > On Thu, Dec 16, 2021 at 12:04 AM Xin Yin <yinxin.x@bytedance.com> wrote:
> > >
> > > If open a file with O_SYNC, and call fallocate with mode=0.when using
> > > fast commit, will cause the process to hang.
> > >
> > > During the fast_commit procedure, it will wait for inode update done.
> > > call ext4_fc_stop_update() before ext4_fc_commit() to mark inode
> > > complete update.
> > >
> > > Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
> > > ---
> > > fs/ext4/extents.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> > > index 4108896d471b..92db33887b6c 100644
> > > --- a/fs/ext4/extents.c
> > > +++ b/fs/ext4/extents.c
> > > @@ -4707,8 +4707,12 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
> > > goto out;
> > >
> > > if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
> > > + ext4_fc_stop_update(inode);
> > > ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal,
> > > EXT4_I(inode)->i_sync_tid);
> > > + inode_unlock(inode);
> > > + trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
> > > + return ret;
> > > }
> > > out:
> > > inode_unlock(inode);
> > > --
> > > 2.20.1
> > >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-23 3:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 8:03 [PATCH] ext4: call fallocate may cause process to hang when using fast commit Xin Yin
2021-12-17 20:17 ` harshad shirwadkar
2021-12-23 2:44 ` harshad shirwadkar
2021-12-23 3:32 ` [External] " Xin Yin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.