All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Scott Mayhew <smayhew@redhat.com>
Cc: jlayton@kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH RFC 1/4] nfsd: fix a warning in __cld_pipe_upcall()
Date: Tue, 27 Nov 2018 16:19:49 -0500	[thread overview]
Message-ID: <20181127211949.GC12810@fieldses.org> (raw)
In-Reply-To: <20181106183511.17836-2-smayhew@redhat.com>

This looks fine, applying now for 4.21.--b.

On Tue, Nov 06, 2018 at 01:35:08PM -0500, Scott Mayhew wrote:
> __cld_pipe_upcall() emits a "do not call blocking ops when
> !TASK_RUNNING" warning due to the dput() call in rpc_queue_upcall().
> Fix it by using a completion instead of hand coding the wait.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> ---
>  fs/nfsd/nfs4recover.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> index 9c247fa1e959..5188f9f70c78 100644
> --- a/fs/nfsd/nfs4recover.c
> +++ b/fs/nfsd/nfs4recover.c
> @@ -662,7 +662,7 @@ struct cld_net {
>  struct cld_upcall {
>  	struct list_head	 cu_list;
>  	struct cld_net		*cu_net;
> -	struct task_struct	*cu_task;
> +	struct completion	 cu_done;
>  	struct cld_msg		 cu_msg;
>  };
>  
> @@ -671,23 +671,18 @@ __cld_pipe_upcall(struct rpc_pipe *pipe, struct cld_msg *cmsg)
>  {
>  	int ret;
>  	struct rpc_pipe_msg msg;
> +	struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_msg);
>  
>  	memset(&msg, 0, sizeof(msg));
>  	msg.data = cmsg;
>  	msg.len = sizeof(*cmsg);
>  
> -	/*
> -	 * Set task state before we queue the upcall. That prevents
> -	 * wake_up_process in the downcall from racing with schedule.
> -	 */
> -	set_current_state(TASK_UNINTERRUPTIBLE);
>  	ret = rpc_queue_upcall(pipe, &msg);
>  	if (ret < 0) {
> -		set_current_state(TASK_RUNNING);
>  		goto out;
>  	}
>  
> -	schedule();
> +	wait_for_completion(&cup->cu_done);
>  
>  	if (msg.errno < 0)
>  		ret = msg.errno;
> @@ -754,7 +749,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
>  	if (copy_from_user(&cup->cu_msg, src, mlen) != 0)
>  		return -EFAULT;
>  
> -	wake_up_process(cup->cu_task);
> +	complete(&cup->cu_done);
>  	return mlen;
>  }
>  
> @@ -769,7 +764,7 @@ cld_pipe_destroy_msg(struct rpc_pipe_msg *msg)
>  	if (msg->errno >= 0)
>  		return;
>  
> -	wake_up_process(cup->cu_task);
> +	complete(&cup->cu_done);
>  }
>  
>  static const struct rpc_pipe_ops cld_upcall_ops = {
> @@ -900,7 +895,7 @@ alloc_cld_upcall(struct cld_net *cn)
>  			goto restart_search;
>  		}
>  	}
> -	new->cu_task = current;
> +	init_completion(&new->cu_done);
>  	new->cu_msg.cm_vers = CLD_UPCALL_VERSION;
>  	put_unaligned(cn->cn_xid++, &new->cu_msg.cm_xid);
>  	new->cu_net = cn;
> -- 
> 2.17.1

  reply	other threads:[~2018-11-27 21:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 18:35 [PATCH RFC 0/4] un-deprecate nfsdcld Scott Mayhew
2018-11-06 18:35 ` [PATCH RFC 1/4] nfsd: fix a warning in __cld_pipe_upcall() Scott Mayhew
2018-11-27 21:19   ` J. Bruce Fields [this message]
2018-11-06 18:35 ` [PATCH RFC 2/4] nfsd: make nfs4_client_reclaim use an xdr_netobj instead of a fixed char array Scott Mayhew
2018-12-06  1:23   ` J. Bruce Fields
2018-11-06 18:35 ` [PATCH RFC 3/4] nfsd: un-deprecate nfsdcld Scott Mayhew
2018-12-06  1:38   ` J. Bruce Fields
2018-11-06 18:35 ` [PATCH RFC 4/4] nfsd: keep a tally of RECLAIM_COMPLETE operations when using nfsdcld Scott Mayhew
2018-11-08  0:28 ` [PATCH RFC 0/4] un-deprecate nfsdcld J. Bruce Fields
2018-11-08 13:07   ` Scott Mayhew

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=20181127211949.GC12810@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=smayhew@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.