diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 376f6eaeb3cbba81e408328cc6da467d79a7f4cc..e302d96ea6466a01e55b38c4c73c3f99dade8225 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2842,12 +2842,12 @@ static int ext4_writepages(struct address_space *mapping, goto unplug; } ret = mpage_prepare_extent_to_map(&mpd); + /* Unlock pages we didn't use */ + mpage_release_unused_pages(&mpd, false); /* Submit prepared bio */ ext4_io_submit(&mpd.io_submit); ext4_put_io_end_defer(mpd.io_submit.io_end); mpd.io_submit.io_end = NULL; - /* Unlock pages we didn't use */ - mpage_release_unused_pages(&mpd, false); if (ret < 0) goto unplug; @@ -2915,10 +2915,11 @@ static int ext4_writepages(struct address_space *mapping, handle = NULL; mpd.do_map = 0; } - /* Submit prepared bio */ - ext4_io_submit(&mpd.io_submit); /* Unlock pages we didn't use */ mpage_release_unused_pages(&mpd, give_up_on_write); + /* Submit prepared bio */ + ext4_io_submit(&mpd.io_submit); + /* * Drop our io_end reference we got from init. We have * to be careful and use deferred io_end finishing if