Do not unlock the written page in ext4_bio_write_page(). Instead leave
the page locked and unlock it in the callers. We'll need to keep the
page locked for data=journal writeback for a bit longer.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20230228051319.4085470-5-tytso@mit.edu
 
                return -ENOMEM;
        }
        ret = ext4_bio_write_page(&io_submit, page, len);
+       unlock_page(page);
        ext4_io_submit(&io_submit);
        /* Drop io_end reference we got from init */
        ext4_put_io_end_defer(io_submit.io_end);
        else
                len = PAGE_SIZE;
        err = ext4_bio_write_page(&mpd->io_submit, page, len);
+       unlock_page(page);
        if (!err)
                mpd->wbc->nr_to_write--;
        mpd->first_page++;
 
 
        /* Nothing to submit? Just unlock the page... */
        if (!nr_to_submit)
-               goto unlock;
+               return 0;
 
        bh = head = page_buffers(page);
 
                                }
                                bh = bh->b_this_page;
                        } while (bh != head);
-                       goto unlock;
+
+                       return ret;
                }
        }
 
                        continue;
                io_submit_add_bh(io, inode, page, bounce_page, bh);
        } while ((bh = bh->b_this_page) != head);
-unlock:
-       unlock_page(page);
-       return ret;
+
+       return 0;
 }