linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Brandenburg <martin@omnibond.com>
To: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org
Cc: Martin Brandenburg <martin@omnibond.com>
Subject: [PATCH 18/24] orangefs: service ops done for writeback are not killable
Date: Tue, 20 Mar 2018 17:02:28 +0000	[thread overview]
Message-ID: <20180320170234.1412-19-martin@omnibond.com> (raw)
In-Reply-To: <20180320170234.1412-1-martin@omnibond.com>

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 --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);
-- 
2.16.2

  parent reply	other threads:[~2018-03-20 17:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 17:02 [PATCH 00/24] orangefs: page cache Martin Brandenburg
2018-03-20 17:02 ` [PATCH 01/24] orangefs: make several *_operations structs static Martin Brandenburg
2018-03-20 17:02 ` [PATCH 02/24] orangefs: remove unused code Martin Brandenburg
2018-03-20 17:02 ` [PATCH 03/24] orangefs: create uapi interface Martin Brandenburg
2018-03-20 17:02 ` [PATCH 04/24] orangefs: open code short single-use functions Martin Brandenburg
2018-03-20 17:02 ` [PATCH 05/24] orangefs: implement vm_ops->fault Martin Brandenburg
2018-03-20 17:02 ` [PATCH 06/24] orangefs: implement xattr cache Martin Brandenburg
2018-03-20 17:02 ` [PATCH 07/24] orangefs: simpler installation documentation Martin Brandenburg
2018-03-20 17:02 ` [PATCH 08/24] orangefs: add tracepoint for service_operation Martin Brandenburg
2018-03-20 17:02 ` [PATCH 09/24] orangefs: tracepoints for orangefs_devreq_{read,write_iter,poll} Martin Brandenburg
2018-03-20 17:02 ` [PATCH 10/24] orangefs: do not invalidate attributes on inode create Martin Brandenburg
2018-03-20 17:02 ` [PATCH 11/24] orangefs: simply orangefs_inode_getattr interface Martin Brandenburg
2018-03-20 17:02 ` [PATCH 12/24] orangefs: update attributes rather than relying on server Martin Brandenburg
2018-03-20 17:02 ` [PATCH 13/24] orangefs: hold i_lock during inode_getattr Martin Brandenburg
2018-03-20 17:02 ` [PATCH 14/24] orangefs: set up and use backing_dev_info Martin Brandenburg
2018-03-20 17:02 ` [PATCH 15/24] orangefs: let setattr write to cached inode Martin Brandenburg
2018-03-20 17:02 ` [PATCH 16/24] orangefs: reorganize setattr functions to track attribute changes Martin Brandenburg
2018-03-20 17:02 ` [PATCH 17/24] orangefs: remove orangefs_readpages Martin Brandenburg
2018-03-20 17:02 ` Martin Brandenburg [this message]
2018-03-20 17:02 ` [PATCH 19/24] orangefs: migrate to generic_file_read_iter Martin Brandenburg
2018-03-20 17:02 ` [PATCH 20/24] orangefs: implement writepage Martin Brandenburg
2018-03-20 17:02 ` [PATCH 21/24] orangefs: skip inode writeout if nothing to write Martin Brandenburg
2018-03-20 17:02 ` [PATCH 22/24] orangefs: write range tracking Martin Brandenburg
2018-03-20 17:02 ` [PATCH 23/24] orangefs: tracepoints for readpage and writeback Martin Brandenburg
2018-03-20 17:02 ` [PATCH 24/24] orangefs: tracepoints for getattr, setattr, and write_inode Martin Brandenburg

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=20180320170234.1412-19-martin@omnibond.com \
    --to=martin@omnibond.com \
    --cc=hubcap@omnibond.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 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).