All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: mfasheh@versity.com, akpm@linux-foundation.org,
	jlbec@evilplan.org, darrick.wong@oracle.com
Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org,
	ocfs2-devel@oss.oracle.com
Subject: [PATCH 5/8] ocfs2: don't eat io errors during _dio_end_io_write
Date: Thu, 01 Dec 2016 16:54:55 -0800	[thread overview]
Message-ID: <148064009501.14039.1495897360461508536.stgit@birch.djwong.org> (raw)
In-Reply-To: <148064006267.14039.3248903225701175868.stgit@birch.djwong.org>

ocfs2_dio_end_io_write eats whatever errors may happen,
which means that write errors do not propagate to userspace.
Fix that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ocfs2/aops.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)


diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 4d037db..136a49c 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2263,10 +2263,10 @@ static int ocfs2_dio_get_block(struct inode *inode, sector_t iblock,
 	return ret;
 }
 
-static void ocfs2_dio_end_io_write(struct inode *inode,
-				   struct ocfs2_dio_write_ctxt *dwc,
-				   loff_t offset,
-				   ssize_t bytes)
+static int ocfs2_dio_end_io_write(struct inode *inode,
+				  struct ocfs2_dio_write_ctxt *dwc,
+				  loff_t offset,
+				  ssize_t bytes)
 {
 	struct ocfs2_cached_dealloc_ctxt dealloc;
 	struct ocfs2_extent_tree et;
@@ -2374,6 +2374,8 @@ static void ocfs2_dio_end_io_write(struct inode *inode,
 	if (locked)
 		inode_unlock(inode);
 	ocfs2_dio_free_write_ctx(inode, dwc);
+
+	return ret;
 }
 
 /*
@@ -2388,6 +2390,7 @@ static int ocfs2_dio_end_io(struct kiocb *iocb,
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
 	int level;
+	int ret = 0;
 
 	if (bytes <= 0)
 		return 0;
@@ -2396,13 +2399,13 @@ static int ocfs2_dio_end_io(struct kiocb *iocb,
 	BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
 
 	if (private)
-		ocfs2_dio_end_io_write(inode, private, offset, bytes);
+		ret = ocfs2_dio_end_io_write(inode, private, offset, bytes);
 
 	ocfs2_iocb_clear_rw_locked(iocb);
 
 	level = ocfs2_iocb_rw_locked_level(iocb);
 	ocfs2_rw_unlock(inode, level);
-	return 0;
+	return ret;
 }
 
 static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)


WARNING: multiple messages have this Message-ID (diff)
From: Darrick J. Wong <darrick.wong@oracle.com>
To: mfasheh@versity.com, akpm@linux-foundation.org,
	jlbec@evilplan.org, darrick.wong@oracle.com
Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org,
	ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 5/8] ocfs2: don't eat io errors during _dio_end_io_write
Date: Thu, 01 Dec 2016 16:54:55 -0800	[thread overview]
Message-ID: <148064009501.14039.1495897360461508536.stgit@birch.djwong.org> (raw)
In-Reply-To: <148064006267.14039.3248903225701175868.stgit@birch.djwong.org>

ocfs2_dio_end_io_write eats whatever errors may happen,
which means that write errors do not propagate to userspace.
Fix that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/ocfs2/aops.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)


diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 4d037db..136a49c 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2263,10 +2263,10 @@ static int ocfs2_dio_get_block(struct inode *inode, sector_t iblock,
 	return ret;
 }
 
-static void ocfs2_dio_end_io_write(struct inode *inode,
-				   struct ocfs2_dio_write_ctxt *dwc,
-				   loff_t offset,
-				   ssize_t bytes)
+static int ocfs2_dio_end_io_write(struct inode *inode,
+				  struct ocfs2_dio_write_ctxt *dwc,
+				  loff_t offset,
+				  ssize_t bytes)
 {
 	struct ocfs2_cached_dealloc_ctxt dealloc;
 	struct ocfs2_extent_tree et;
@@ -2374,6 +2374,8 @@ static void ocfs2_dio_end_io_write(struct inode *inode,
 	if (locked)
 		inode_unlock(inode);
 	ocfs2_dio_free_write_ctx(inode, dwc);
+
+	return ret;
 }
 
 /*
@@ -2388,6 +2390,7 @@ static int ocfs2_dio_end_io(struct kiocb *iocb,
 {
 	struct inode *inode = file_inode(iocb->ki_filp);
 	int level;
+	int ret = 0;
 
 	if (bytes <= 0)
 		return 0;
@@ -2396,13 +2399,13 @@ static int ocfs2_dio_end_io(struct kiocb *iocb,
 	BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
 
 	if (private)
-		ocfs2_dio_end_io_write(inode, private, offset, bytes);
+		ret = ocfs2_dio_end_io_write(inode, private, offset, bytes);
 
 	ocfs2_iocb_clear_rw_locked(iocb);
 
 	level = ocfs2_iocb_rw_locked_level(iocb);
 	ocfs2_rw_unlock(inode, level);
-	return 0;
+	return ret;
 }
 
 static ssize_t ocfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter)

  parent reply	other threads:[~2016-12-02  0:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02  0:54 [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Darrick J. Wong
2016-12-02  0:54 ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Darrick J. Wong
2016-12-02  0:54 ` [PATCH 1/8] ocfs2: convert inode refcount test to a helper Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 2/8] ocfs2: add newlines to some error messages Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 3/8] ocfs2: prohibit refcounted swapfiles Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` [PATCH 4/8] ocfs2: budget for extent tree splits when adding refcount flag Darrick J. Wong
2016-12-02  0:54   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:54 ` Darrick J. Wong [this message]
2016-12-02  0:54   ` [Ocfs2-devel] [PATCH 5/8] ocfs2: don't eat io errors during _dio_end_io_write Darrick J. Wong
2016-12-02  0:55 ` [PATCH 6/8] ocfs2: always unlock when completing dio writes Darrick J. Wong
2016-12-02  0:55   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:55 ` [PATCH 7/8] ocfs2: implement the VFS clone_range, copy_range, and dedupe_range features Darrick J. Wong
2016-12-02  0:55   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-02  0:55 ` [PATCH 8/8] ocfs2: charge quota for reflinked blocks Darrick J. Wong
2016-12-02  0:55   ` [Ocfs2-devel] " Darrick J. Wong
2016-12-09  7:32 ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Darrick J. Wong
2016-12-09  7:32   ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Darrick J. Wong
2016-12-09  8:22   ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Christoph Hellwig
2016-12-09  8:22     ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Christoph Hellwig
2016-12-10  1:52     ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Al Viro
2016-12-10  1:52       ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Al Viro
2016-12-10  8:46       ` [PATCH v3 0/8] ocfs2: wire up {clone,copy,dedupe}_range Christoph Hellwig
2016-12-10  8:46         ` [Ocfs2-devel] [PATCH v3 0/8] ocfs2: wire up {clone, copy, dedupe}_range Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=148064009501.14039.1495897360461508536.stgit@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mfasheh@versity.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.