e7a346
From 3e7c6b338deb7a8b95b208b1aa087f97fb58549f Mon Sep 17 00:00:00 2001
e7a346
From: Raghavendra G <rgowdapp@redhat.com>
e7a346
Date: Fri, 25 May 2018 08:16:41 +0530
e7a346
Subject: [PATCH 287/305] Revert "performance/write-behind: fix flush stuck by
e7a346
 former failed writes"
e7a346
e7a346
This reverts commit 9340b3c7a6c8556d6f1d4046de0dbd1946a64963.
e7a346
e7a346
operations/writes across different fds of the same file cannot be
e7a346
considered as independent. For eg., man 2 fsync states,
e7a346
e7a346
<man 2 fsync>
e7a346
e7a346
fsync()  transfers  ("flushes")  all  modified  in-core  data of
e7a346
(i.e., modified buffer cache pages for) the file referred to by the
e7a346
file descriptor fd to the disk device
e7a346
e7a346
</man>
e7a346
e7a346
This means fsync is an operation on file and fd is just a way to reach
e7a346
file. So, it has to sync writes done on other fds too. Patch
e7a346
9340b3c7a6c, prevents this.
e7a346
e7a346
The problem fixed by patch 9340b3c7a6c - a flush on an fd is hung on a
e7a346
failed write (held in cache for retrying) on a different fd - is
e7a346
solved in this patch by making sure __wb_request_waiting_on considers
e7a346
failed writes on any fd as dependent on flush/fsync on any fd (not
e7a346
just the fd on which writes happened) opened on the same file. This
e7a346
means failed writes on any fd are either synced or thrown away on
e7a346
witnessing flush/fsync on any fd of the same file.
e7a346
e7a346
>Change-Id: Iee748cebb6d2a5b32f9328aff2b5b7cbf6c52c05
e7a346
>Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
e7a346
>Updates: bz#1512691
e7a346
e7a346
upstream patch: https://review.gluster.org/20082
e7a346
BUG: 1518710
e7a346
Change-Id: Ie9df1cb2fcd698db3d186485fd61ea6dc1c1fcb7
e7a346
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/140063
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Csaba Henk <chenk@redhat.com>
e7a346
Tested-by: Csaba Henk <chenk@redhat.com>
e7a346
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e7a346
---
e7a346
 xlators/performance/write-behind/src/write-behind.c | 9 ++-------
e7a346
 1 file changed, 2 insertions(+), 7 deletions(-)
e7a346
e7a346
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
e7a346
index 7104eb9..ca1cb63 100644
e7a346
--- a/xlators/performance/write-behind/src/write-behind.c
e7a346
+++ b/xlators/performance/write-behind/src/write-behind.c
e7a346
@@ -287,10 +287,6 @@ wb_requests_conflict (wb_request_t *lie, wb_request_t *req)
e7a346
 		   us in the todo list */
e7a346
 		return _gf_false;
e7a346
 
e7a346
-        /* requests from different fd do not conflict with each other. */
e7a346
-        if (req->fd && (req->fd != lie->fd))
e7a346
-                return _gf_false;
e7a346
-
e7a346
 	if (lie->ordering.append)
e7a346
 		/* all modifications wait for the completion
e7a346
 		   of outstanding append */
e7a346
@@ -743,9 +739,8 @@ __wb_request_waiting_on (wb_request_t *req)
e7a346
         wb_inode = req->wb_inode;
e7a346
 
e7a346
         list_for_each_entry (trav, &wb_inode->todo, todo) {
e7a346
-                if ((trav->fd == req->fd)
e7a346
-                    && ((trav->stub->fop == GF_FOP_FLUSH)
e7a346
-                        || (trav->stub->fop == GF_FOP_FSYNC))
e7a346
+                if (((trav->stub->fop == GF_FOP_FLUSH) || (trav->stub->fop
e7a346
+                                                           == GF_FOP_FSYNC))
e7a346
                     && (trav->gen >= req->gen))
e7a346
                         return trav;
e7a346
         }
e7a346
-- 
e7a346
1.8.3.1
e7a346