Wengang Wang 5040f8df56 ocfs2: free up write context when direct IO failed
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.

Link: http://lkml.kernel.org/r/20181102170632.25921-1-wen.gang.wang@oracle.com
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Changwei Ge <ge.changwei@h3c.com>
Reviewed-by: Joseph Qi <jiangqi903@gmail.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-11-18 10:15:09 -08:00
..
2018-11-11 16:54:38 -06:00
2018-09-04 11:35:03 +08:00
2018-08-21 23:54:17 -04:00
\n
2018-10-29 10:23:36 -07:00
2018-08-17 16:20:28 -07:00
2018-09-29 22:47:48 -04:00
2018-10-26 16:26:33 -07:00
2018-05-22 14:27:52 -04:00
2018-10-21 10:46:42 -04:00
2018-10-12 22:46:50 -04:00
2018-11-01 11:46:27 -07:00
2018-10-31 08:54:15 -07:00
2018-05-22 14:27:52 -04:00
2018-08-18 11:44:53 -07:00
2018-10-23 13:49:02 +02:00
2018-09-07 10:32:23 +02:00
2018-07-03 16:44:45 -04:00
2018-10-24 00:40:44 +01:00
2018-11-02 11:25:48 -07:00
2018-10-29 14:29:58 -07:00
2018-06-05 19:23:26 +02:00
2018-10-31 08:54:16 -07:00
2018-10-24 00:40:44 +01:00
2018-08-21 18:19:09 -07:00
2018-10-21 10:46:42 -04:00
2018-08-21 18:19:09 -07:00
2018-06-11 08:22:34 -07:00
2018-08-21 18:19:09 -07:00
2018-08-21 18:19:09 -07:00
2018-09-03 15:14:01 +02:00
2018-04-04 12:44:02 -07:00