gfs2: Don't re-check for write past EOF unnecessarily
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 19 Apr 2022 18:51:50 +0000 (20:51 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 26 Apr 2022 13:38:00 +0000 (15:38 +0200)
Only re-check for direct I/O writes past the end of the file after
re-acquiring the inode glock.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/file.c

index 22b41ac..8d88923 100644 (file)
@@ -899,10 +899,10 @@ retry:
        ret = gfs2_glock_nq(gh);
        if (ret)
                goto out_uninit;
-retry_under_glock:
        /* Silently fall back to buffered I/O when writing beyond EOF */
        if (iocb->ki_pos + iov_iter_count(from) > i_size_read(&ip->i_inode))
                goto out;
+retry_under_glock:
 
        from->nofault = true;
        ret = iomap_dio_rw(iocb, from, &gfs2_iomap_ops, NULL,