diff mbox

[18/24] orangefs: service ops done for writeback are not killable

Message ID 20180320170234.1412-19-martin@omnibond.com (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Brandenburg March 20, 2018, 5:02 p.m. UTC
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
---
 fs/orangefs/orangefs-kernel.h |  1 +
 fs/orangefs/orangefs-utils.c  |  6 ++++--
 fs/orangefs/waitqueue.c       | 20 +++++++++++---------
 3 files changed, 16 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index dedc96aa69fc..525656d928d4 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -443,6 +443,7 @@  extern const struct dentry_operations orangefs_dentry_operations;
 #define ORANGEFS_OP_CANCELLATION  4   /* this is a cancellation */
 #define ORANGEFS_OP_NO_MUTEX      8   /* don't acquire request_mutex */
 #define ORANGEFS_OP_ASYNC         16  /* Queue it, but don't wait */
+#define ORANGEFS_OP_WRITEBACK     32
 
 int service_operation(struct orangefs_kernel_op_s *, int);
 
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index d34b9a90f6d7..0e52208726fd 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -270,7 +270,8 @@  int orangefs_inode_getattr(struct inode *inode, int flags)
 		new_op->upcall.req.getattr.mask =
 		    ORANGEFS_ATTR_SYS_ALL_NOHINT & ~ORANGEFS_ATTR_SYS_SIZE;
 
-	ret = service_operation(new_op, get_interruptible_flag(inode));
+	ret = service_operation(new_op,
+	    get_interruptible_flag(inode));
 	if (ret != 0)
 		goto out;
 
@@ -429,7 +430,8 @@  int orangefs_inode_setattr(struct inode *inode)
 	orangefs_inode->attr_valid = 0;
 	spin_unlock(&inode->i_lock);
 
-	ret = service_operation(new_op, get_interruptible_flag(inode));
+	ret = service_operation(new_op,
+	    get_interruptible_flag(inode) | ORANGEFS_OP_WRITEBACK);
 	gossip_debug(GOSSIP_UTILS_DEBUG,
 	    "orangefs_inode_setattr: returning %d\n", ret);
 	if (ret)
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index c345a1d7fde2..b02ca891f999 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -17,7 +17,7 @@ 
 #include "orangefs-bufmap.h"
 #include "orangefs-trace.h"
 
-static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, long, bool);
+static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, long, int);
 static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *);
 
 /*
@@ -138,9 +138,7 @@  int service_operation(struct orangefs_kernel_op_s *op, int flags)
 	if (!(flags & ORANGEFS_OP_NO_MUTEX))
 		mutex_unlock(&orangefs_request_mutex);
 
-	ret = wait_for_matching_downcall(op, timeout,
-					 flags & ORANGEFS_OP_INTERRUPTIBLE);
-
+	ret = wait_for_matching_downcall(op, timeout, flags);
 	gossip_debug(GOSSIP_WAIT_DEBUG,
 		     "%s: wait_for_matching_downcall returned %d for %p\n",
 		     __func__,
@@ -311,10 +309,12 @@  static void
  * Returns with op->lock taken.
  */
 static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
-				      long timeout,
-				      bool interruptible)
+				      long timeout, int flags)
 {
 	long n;
+	int writeback = flags & ORANGEFS_OP_WRITEBACK,
+	    interruptible = flags & ORANGEFS_OP_INTERRUPTIBLE;
+
 
 	/*
 	 * There's a "schedule_timeout" inside of these wait
@@ -322,10 +322,12 @@  static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
 	 * user process that needs something done and is being
 	 * manipulated by the client-core process.
 	 */
-	if (interruptible)
+	if (writeback)
+		n = wait_for_completion_io_timeout(&op->waitq, timeout);
+	else if (!writeback && interruptible)
 		n = wait_for_completion_interruptible_timeout(&op->waitq,
-							      timeout);
-	else
+								      timeout);
+	else /* !writeback && !interruptible but compiler complains */
 		n = wait_for_completion_killable_timeout(&op->waitq, timeout);
 
 	spin_lock(&op->lock);