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