On Fri, Nov 02, 2018 at 10:06:32AM -0700, Wengang Wang wrote: > The write context should also be freed even when direct IO failed. > Otherwise a memory leak is introduced and entries remain in > oi->ip_unwritten_list causing the following BUG later in unlink path: > > ERROR: bug expression: !list_empty(&oi->ip_unwritten_list) > ERROR: Clear inode of 215043, inode has unwritten extents > ... > Call Trace: > ? __set_current_blocked+0x42/0x68 > ocfs2_evict_inode+0x91/0x6a0 [ocfs2] > ? bit_waitqueue+0x40/0x33 > evict+0xdb/0x1af > iput+0x1a2/0x1f7 > do_unlinkat+0x194/0x28f > SyS_unlinkat+0x1b/0x2f > do_syscall_64+0x79/0x1ae > entry_SYSCALL_64_after_hwframe+0x151/0x0 > > This patch also logs, with frequency limit, direct IO failures. > > Signed-off-by: Wengang Wang <wen.gang.wang@xxxxxxxxxx> > --- > v1 -> v2: log direct IO failures > --- > fs/ocfs2/aops.c | 12 ++++++++++-- > fs/ocfs2/cluster/masklog.h | 9 +++++++++ > 2 files changed, 19 insertions(+), 2 deletions(-) <formletter> This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly. </formletter>