stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "ocfs2: direct write will call ocfs2_rw_unlock() twice when doing aio+dio" has been added to the 4.2-stable tree
@ 2015-09-19 16:08 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-09-19 16:08 UTC (permalink / raw)
  To: ryan.ding, akpm, gregkh, jlbec, junxiao.bi, mfasheh, torvalds,
	viro
  Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    ocfs2: direct write will call ocfs2_rw_unlock() twice when doing aio+dio

to the 4.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ocfs2-direct-write-will-call-ocfs2_rw_unlock-twice-when-doing-aio-dio.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From aa1057b3dec478b20c77bad07442318ae36d893c Mon Sep 17 00:00:00 2001
From: Ryan Ding <ryan.ding@oracle.com>
Date: Fri, 4 Sep 2015 15:42:36 -0700
Subject: ocfs2: direct write will call ocfs2_rw_unlock() twice when doing aio+dio

From: Ryan Ding <ryan.ding@oracle.com>

commit aa1057b3dec478b20c77bad07442318ae36d893c upstream.

ocfs2_file_write_iter() is usng the wrong return value ('written').  This
will cause ocfs2_rw_unlock() be called both in write_iter & end_io,
triggering a BUG_ON.

This issue was introduced by commit 7da839c47589 ("ocfs2: use
__generic_file_write_iter()").

Orabug: 21612107
Fixes: 7da839c47589 ("ocfs2: use __generic_file_write_iter()")
Signed-off-by: Ryan Ding <ryan.ding@oracle.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ocfs2/file.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2372,6 +2372,20 @@ relock:
 	/* buffered aio wouldn't have proper lock coverage today */
 	BUG_ON(written == -EIOCBQUEUED && !(iocb->ki_flags & IOCB_DIRECT));
 
+	/*
+	 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
+	 * function pointer which is called when o_direct io completes so that
+	 * it can unlock our rw lock.
+	 * Unfortunately there are error cases which call end_io and others
+	 * that don't.  so we don't have to unlock the rw_lock if either an
+	 * async dio is going to do it in the future or an end_io after an
+	 * error has already done it.
+	 */
+	if ((written == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) {
+		rw_level = -1;
+		unaligned_dio = 0;
+	}
+
 	if (unlikely(written <= 0))
 		goto no_sync;
 
@@ -2396,20 +2410,6 @@ relock:
 	}
 
 no_sync:
-	/*
-	 * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io
-	 * function pointer which is called when o_direct io completes so that
-	 * it can unlock our rw lock.
-	 * Unfortunately there are error cases which call end_io and others
-	 * that don't.  so we don't have to unlock the rw_lock if either an
-	 * async dio is going to do it in the future or an end_io after an
-	 * error has already done it.
-	 */
-	if ((ret == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) {
-		rw_level = -1;
-		unaligned_dio = 0;
-	}
-
 	if (unaligned_dio) {
 		ocfs2_iocb_clear_unaligned_aio(iocb);
 		mutex_unlock(&OCFS2_I(inode)->ip_unaligned_aio);


Patches currently in stable-queue which might be from ryan.ding@oracle.com are

queue-4.2/ocfs2-direct-write-will-call-ocfs2_rw_unlock-twice-when-doing-aio-dio.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-19 16:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-19 16:08 Patch "ocfs2: direct write will call ocfs2_rw_unlock() twice when doing aio+dio" has been added to the 4.2-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).