@@ -72,63 +72,20 @@ static u32 iomap_finish_ioend_buffered_write(struct iomap_ioend *ioend)
7272 return folio_count ;
7373}
7474
75- static DEFINE_SPINLOCK (failed_ioend_lock );
76- static LIST_HEAD (failed_ioend_list );
77-
78- static void
79- iomap_fail_ioends (
80- struct work_struct * work )
81- {
82- struct iomap_ioend * ioend ;
83- struct list_head tmp ;
84- unsigned long flags ;
85-
86- spin_lock_irqsave (& failed_ioend_lock , flags );
87- list_replace_init (& failed_ioend_list , & tmp );
88- spin_unlock_irqrestore (& failed_ioend_lock , flags );
89-
90- while ((ioend = list_first_entry_or_null (& tmp , struct iomap_ioend ,
91- io_list ))) {
92- list_del_init (& ioend -> io_list );
93- iomap_finish_ioend_buffered_write (ioend );
94- cond_resched ();
95- }
96- }
97-
98- static DECLARE_WORK (failed_ioend_work , iomap_fail_ioends ) ;
99-
100- static void iomap_fail_ioend_buffered (struct iomap_ioend * ioend )
101- {
102- unsigned long flags ;
103-
104- /*
105- * Bounce I/O errors to a workqueue to avoid nested i_lock acquisitions
106- * in the fserror code. The caller no longer owns the ioend reference
107- * after the spinlock drops.
108- */
109- spin_lock_irqsave (& failed_ioend_lock , flags );
110- if (list_empty (& failed_ioend_list ))
111- WARN_ON_ONCE (!schedule_work (& failed_ioend_work ));
112- list_add_tail (& ioend -> io_list , & failed_ioend_list );
113- spin_unlock_irqrestore (& failed_ioend_lock , flags );
114- }
115-
11675static void ioend_writeback_end_bio (struct bio * bio )
11776{
11877 struct iomap_ioend * ioend = iomap_ioend_from_bio (bio );
11978
120- /* Page cache invalidation cannot be done in irq context. */
121- if (ioend -> io_flags & IOMAP_IOEND_DONTCACHE ) {
79+ /*
80+ * Page cache invalidation and error reporting cannot be done in irq
81+ * context.
82+ */
83+ if ((ioend -> io_flags & IOMAP_IOEND_DONTCACHE ) || bio -> bi_status ) {
12284 if (bio_complete_in_task (bio ))
12385 return ;
12486 }
12587
12688 ioend -> io_error = blk_status_to_errno (bio -> bi_status );
127- if (ioend -> io_error ) {
128- iomap_fail_ioend_buffered (ioend );
129- return ;
130- }
131-
13289 iomap_finish_ioend_buffered_write (ioend );
13390}
13491
0 commit comments