[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    gfs2: Prevent direct-I/O write fallback errors from getting lost
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2021-05-31 16:36:25
Message-ID: git-mailbomb-linux-master-43a511c44e58e357a687d61a20cf5ef1dc9e5a7c () kernel ! org
[Download RAW message or body]

Commit:     43a511c44e58e357a687d61a20cf5ef1dc9e5a7c
Parent:     d07f6ca923ea0927a1024dfccafc5b53b61cfecc
Refname:    refs/heads/master
Web:        https://git.kernel.org/torvalds/c/43a511c44e58e357a687d61a20cf5ef1dc9e5a7c
Author:     Andreas Gruenbacher <agruenba@redhat.com>
AuthorDate: Mon May 10 12:25:59 2021 +0200
Committer:  Andreas Gruenbacher <agruenba@redhat.com>
CommitDate: Thu May 20 13:31:36 2021 +0200

    gfs2: Prevent direct-I/O write fallback errors from getting lost
    
    When a direct I/O write falls entirely and falls back to buffered I/O and the
    buffered I/O fails, the write failed with return value 0 instead of the error
    number reported by the buffered I/O. Fix that.
    
    Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index a0b542d84cd9e..493a83e3f5906 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -911,8 +911,11 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 		current->backing_dev_info = inode_to_bdi(inode);
 		buffered = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
 		current->backing_dev_info = NULL;
-		if (unlikely(buffered <= 0))
+		if (unlikely(buffered <= 0)) {
+			if (!ret)
+				ret = buffered;
 			goto out_unlock;
+		}
 
 		/*
 		 * We need to ensure that the page cache pages are written to
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic