diff mbox series

[2/4] SUNRPC: Widen rpc_task::tk_flags

Message ID 165851073589.361126.4062184829827389945.stgit@morisot.1015granger.net (mailing list archive)
State New, archived
Headers show
Series Pre-requisites for client-side RPC-with-TLS support | expand

Commit Message

Chuck Lever July 22, 2022, 5:25 p.m. UTC
There is just one unused bit left in rpc_task::tk_flags, and I will
need two in subsequent patches. Double the width of the field to
accommodate more flag bits.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 include/linux/sunrpc/clnt.h  |    6 ++++--
 include/linux/sunrpc/sched.h |   32 ++++++++++++++++----------------
 net/sunrpc/clnt.c            |   11 ++++++-----
 net/sunrpc/debugfs.c         |    2 +-
 4 files changed, 27 insertions(+), 24 deletions(-)

Comments

Trond Myklebust July 22, 2022, 5:53 p.m. UTC | #1
On Fri, 2022-07-22 at 13:25 -0400, Chuck Lever wrote:
> There is just one unused bit left in rpc_task::tk_flags, and I will
> need two in subsequent patches. Double the width of the field to
> accommodate more flag bits.

The values 0x8 and 0x40 are both free, so I'm not seeing why this patch
is needed at this time.

> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  include/linux/sunrpc/clnt.h  |    6 ++++--
>  include/linux/sunrpc/sched.h |   32 ++++++++++++++++----------------
>  net/sunrpc/clnt.c            |   11 ++++++-----
>  net/sunrpc/debugfs.c         |    2 +-
>  4 files changed, 27 insertions(+), 24 deletions(-)
> 
> diff --git a/include/linux/sunrpc/clnt.h
> b/include/linux/sunrpc/clnt.h
> index 90501404fa49..cbdd20dc84b7 100644
> --- a/include/linux/sunrpc/clnt.h
> +++ b/include/linux/sunrpc/clnt.h
> @@ -193,11 +193,13 @@ void rpc_prepare_reply_pages(struct rpc_rqst
> *req, struct page **pages,
>                              unsigned int hdrsize);
>  void           rpc_call_start(struct rpc_task *);
>  int            rpc_call_async(struct rpc_clnt *clnt,
> -                              const struct rpc_message *msg, int
> flags,
> +                              const struct rpc_message *msg,
> +                              unsigned int flags,
>                                const struct rpc_call_ops *tk_ops,
>                                void *calldata);
>  int            rpc_call_sync(struct rpc_clnt *clnt,
> -                             const struct rpc_message *msg, int
> flags);
> +                             const struct rpc_message *msg,
> +                             unsigned int flags);
>  struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct
> rpc_cred *cred,
>                                int flags);
>  int            rpc_restart_call_prepare(struct rpc_task *);
> diff --git a/include/linux/sunrpc/sched.h
> b/include/linux/sunrpc/sched.h
> index 1d7a3e51b795..d4b7ebd0a99c 100644
> --- a/include/linux/sunrpc/sched.h
> +++ b/include/linux/sunrpc/sched.h
> @@ -82,7 +82,7 @@ struct rpc_task {
>         ktime_t                 tk_start;       /* RPC task init
> timestamp */
>  
>         pid_t                   tk_owner;       /* Process id for
> batching tasks */
> -       unsigned short          tk_flags;       /* misc flags */
> +       unsigned int            tk_flags;       /* misc flags */
>         unsigned short          tk_timeouts;    /* maj timeouts */
>  
>  #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) ||
> IS_ENABLED(CONFIG_TRACEPOINTS)
> @@ -112,27 +112,27 @@ struct rpc_task_setup {
>         const struct rpc_call_ops *callback_ops;
>         void *callback_data;
>         struct workqueue_struct *workqueue;
> -       unsigned short flags;
> +       unsigned int flags;
>         signed char priority;
>  };
>  
>  /*
>   * RPC task flags
>   */
> -#define RPC_TASK_ASYNC         0x0001          /* is an async task
> */
> -#define RPC_TASK_SWAPPER       0x0002          /* is swapping in/out
> */
> -#define RPC_TASK_MOVEABLE      0x0004          /* nfs4.1+ rpc tasks
> */
> -#define RPC_TASK_NULLCREDS     0x0010          /* Use AUTH_NULL
> credential */
> -#define RPC_CALL_MAJORSEEN     0x0020          /* major timeout seen
> */
> -#define RPC_TASK_DYNAMIC       0x0080          /* task was
> kmalloc'ed */
> -#define        RPC_TASK_NO_ROUND_ROBIN 0x0100          /* send
> requests on "main" xprt */
> -#define RPC_TASK_SOFT          0x0200          /* Use soft timeouts
> */
> -#define RPC_TASK_SOFTCONN      0x0400          /* Fail if can't
> connect */
> -#define RPC_TASK_SENT          0x0800          /* message was sent
> */
> -#define RPC_TASK_TIMEOUT       0x1000          /* fail with
> ETIMEDOUT on timeout */
> -#define RPC_TASK_NOCONNECT     0x2000          /* return ENOTCONN if
> not connected */
> -#define RPC_TASK_NO_RETRANS_TIMEOUT    0x4000          /* wait
> forever for a reply */
> -#define RPC_TASK_CRED_NOREF    0x8000          /* No refcount on the
> credential */
> +#define RPC_TASK_ASYNC                 0x00000001      /* is an
> async task */
> +#define RPC_TASK_SWAPPER               0x00000002      /* is
> swapping in/out */
> +#define RPC_TASK_MOVEABLE              0x00000004      /* nfs4.1+
> rpc tasks */
> +#define RPC_TASK_NULLCREDS             0x00000010      /* Use
> AUTH_NULL credential */
> +#define RPC_CALL_MAJORSEEN             0x00000020      /* major
> timeout seen */
> +#define RPC_TASK_DYNAMIC               0x00000080      /* task was
> kmalloc'ed */
> +#define        RPC_TASK_NO_ROUND_ROBIN         0x00000100      /*
> send requests on "main" xprt */
> +#define RPC_TASK_SOFT                  0x00000200      /* Use soft
> timeouts */
> +#define RPC_TASK_SOFTCONN              0x00000400      /* Fail if
> can't connect */
> +#define RPC_TASK_SENT                  0x00000800      /* message
> was sent */
> +#define RPC_TASK_TIMEOUT               0x00001000      /* fail with
> ETIMEDOUT on timeout */
> +#define RPC_TASK_NOCONNECT             0x00002000      /* return
> ENOTCONN if not connected */
> +#define RPC_TASK_NO_RETRANS_TIMEOUT    0x00004000      /* wait
> forever for a reply */
> +#define RPC_TASK_CRED_NOREF            0x00008000      /* No
> refcount on the credential */
>  
>  #define RPC_IS_ASYNC(t)                ((t)->tk_flags &
> RPC_TASK_ASYNC)
>  #define RPC_IS_SWAPPER(t)      ((t)->tk_flags & RPC_TASK_SWAPPER)
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index a97d4e06cae3..476caa4ebf5c 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -1162,7 +1162,8 @@ EXPORT_SYMBOL_GPL(rpc_run_task);
>   * @msg: RPC call parameters
>   * @flags: RPC call flags
>   */
> -int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message
> *msg, int flags)
> +int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message
> *msg,
> +                 unsigned int flags)
>  {
>         struct rpc_task *task;
>         struct rpc_task_setup task_setup_data = {
> @@ -1197,9 +1198,9 @@ EXPORT_SYMBOL_GPL(rpc_call_sync);
>   * @tk_ops: RPC call ops
>   * @data: user call data
>   */
> -int
> -rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg,
> int flags,
> -              const struct rpc_call_ops *tk_ops, void *data)
> +int rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message
> *msg,
> +                  unsigned int flags, const struct rpc_call_ops
> *tk_ops,
> +                  void *data)
>  {
>         struct rpc_task *task;
>         struct rpc_task_setup task_setup_data = {
> @@ -3080,7 +3081,7 @@ static void rpc_show_task(const struct rpc_clnt
> *clnt,
>         if (RPC_IS_QUEUED(task))
>                 rpc_waitq = rpc_qname(task->tk_waitqueue);
>  
> -       printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s
> a:%ps q:%s\n",
> +       printk(KERN_INFO "%5u %08x %6d %8p %8p %8ld %8p %sv%u %s
> a:%ps q:%s\n",
>                 task->tk_pid, task->tk_flags, task->tk_status,
>                 clnt, task->tk_rqstp, rpc_task_timeout(task), task-
> >tk_ops,
>                 clnt->cl_program->name, clnt->cl_vers,
> rpc_proc_name(task),
> diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
> index 8df634e63f30..60f20be4e7e5 100644
> --- a/net/sunrpc/debugfs.c
> +++ b/net/sunrpc/debugfs.c
> @@ -30,7 +30,7 @@ tasks_show(struct seq_file *f, void *v)
>         if (task->tk_rqstp)
>                 xid = be32_to_cpu(task->tk_rqstp->rq_xid);
>  
> -       seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps
> q:%s\n",
> +       seq_printf(f, "%5u %08x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps
> q:%s\n",
>                 task->tk_pid, task->tk_flags, task->tk_status,
>                 clnt->cl_clid, xid, rpc_task_timeout(task), task-
> >tk_ops,
>                 clnt->cl_program->name, clnt->cl_vers,
> rpc_proc_name(task),
> 
>
Chuck Lever July 22, 2022, 5:55 p.m. UTC | #2
> On Jul 22, 2022, at 1:53 PM, Trond Myklebust <trondmy@hammerspace.com> wrote:
> 
> On Fri, 2022-07-22 at 13:25 -0400, Chuck Lever wrote:
>> There is just one unused bit left in rpc_task::tk_flags, and I will
>> need two in subsequent patches. Double the width of the field to
>> accommodate more flag bits.
> 
> The values 0x8 and 0x40 are both free, so I'm not seeing why this patch
> is needed at this time.

It's not needed now, but as recently as last year, there were no free
bits (and I needed them for RPC-with-TLS support at that time). We will
have to widen this field sooner or later.

I don't have a problem dropping this one if you'd rather wait.


>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> Reviewed-by: Jeff Layton <jlayton@kernel.org>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>> include/linux/sunrpc/clnt.h  |  6 ++++--
>> include/linux/sunrpc/sched.h |  32 ++++++++++++++++----------------
>> net/sunrpc/clnt.c  |  11 ++++++-----
>> net/sunrpc/debugfs.c  |  2 +-
>> 4 files changed, 27 insertions(+), 24 deletions(-)
>> 
>> diff --git a/include/linux/sunrpc/clnt.h
>> b/include/linux/sunrpc/clnt.h
>> index 90501404fa49..cbdd20dc84b7 100644
>> --- a/include/linux/sunrpc/clnt.h
>> +++ b/include/linux/sunrpc/clnt.h
>> @@ -193,11 +193,13 @@ void rpc_prepare_reply_pages(struct rpc_rqst
>> *req, struct page **pages,
>> unsigned int hdrsize);
>> void  rpc_call_start(struct rpc_task *);
>> int  rpc_call_async(struct rpc_clnt *clnt,
>> -  const struct rpc_message *msg, int
>> flags,
>> +  const struct rpc_message *msg,
>> +  unsigned int flags,
>> const struct rpc_call_ops *tk_ops,
>> void *calldata);
>> int  rpc_call_sync(struct rpc_clnt *clnt,
>> -  const struct rpc_message *msg, int
>> flags);
>> +  const struct rpc_message *msg,
>> +  unsigned int flags);
>> struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct
>> rpc_cred *cred,
>> int flags);
>> int  rpc_restart_call_prepare(struct rpc_task *);
>> diff --git a/include/linux/sunrpc/sched.h
>> b/include/linux/sunrpc/sched.h
>> index 1d7a3e51b795..d4b7ebd0a99c 100644
>> --- a/include/linux/sunrpc/sched.h
>> +++ b/include/linux/sunrpc/sched.h
>> @@ -82,7 +82,7 @@ struct rpc_task {
>> ktime_t  tk_start;  /* RPC task init
>> timestamp */
>> 
>> pid_t  tk_owner;  /* Process id for
>> batching tasks */
>> -  unsigned short  tk_flags;  /* misc flags */
>> +  unsigned int  tk_flags;  /* misc flags */
>> unsigned short  tk_timeouts;  /* maj timeouts */
>> 
>> #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) ||
>> IS_ENABLED(CONFIG_TRACEPOINTS)
>> @@ -112,27 +112,27 @@ struct rpc_task_setup {
>> const struct rpc_call_ops *callback_ops;
>> void *callback_data;
>> struct workqueue_struct *workqueue;
>> -  unsigned short flags;
>> +  unsigned int flags;
>> signed char priority;
>> };
>> 
>> /*
>> * RPC task flags
>> */
>> -#define RPC_TASK_ASYNC  0x0001  /* is an async task
>> */
>> -#define RPC_TASK_SWAPPER  0x0002  /* is swapping in/out
>> */
>> -#define RPC_TASK_MOVEABLE  0x0004  /* nfs4.1+ rpc tasks
>> */
>> -#define RPC_TASK_NULLCREDS  0x0010  /* Use AUTH_NULL
>> credential */
>> -#define RPC_CALL_MAJORSEEN  0x0020  /* major timeout seen
>> */
>> -#define RPC_TASK_DYNAMIC  0x0080  /* task was
>> kmalloc'ed */
>> -#define  RPC_TASK_NO_ROUND_ROBIN 0x0100  /* send
>> requests on "main" xprt */
>> -#define RPC_TASK_SOFT  0x0200  /* Use soft timeouts
>> */
>> -#define RPC_TASK_SOFTCONN  0x0400  /* Fail if can't
>> connect */
>> -#define RPC_TASK_SENT  0x0800  /* message was sent
>> */
>> -#define RPC_TASK_TIMEOUT  0x1000  /* fail with
>> ETIMEDOUT on timeout */
>> -#define RPC_TASK_NOCONNECT  0x2000  /* return ENOTCONN if
>> not connected */
>> -#define RPC_TASK_NO_RETRANS_TIMEOUT  0x4000  /* wait
>> forever for a reply */
>> -#define RPC_TASK_CRED_NOREF  0x8000  /* No refcount on the
>> credential */
>> +#define RPC_TASK_ASYNC  0x00000001  /* is an
>> async task */
>> +#define RPC_TASK_SWAPPER  0x00000002  /* is
>> swapping in/out */
>> +#define RPC_TASK_MOVEABLE  0x00000004  /* nfs4.1+
>> rpc tasks */
>> +#define RPC_TASK_NULLCREDS  0x00000010  /* Use
>> AUTH_NULL credential */
>> +#define RPC_CALL_MAJORSEEN  0x00000020  /* major
>> timeout seen */
>> +#define RPC_TASK_DYNAMIC  0x00000080  /* task was
>> kmalloc'ed */
>> +#define  RPC_TASK_NO_ROUND_ROBIN  0x00000100  /*
>> send requests on "main" xprt */
>> +#define RPC_TASK_SOFT  0x00000200  /* Use soft
>> timeouts */
>> +#define RPC_TASK_SOFTCONN  0x00000400  /* Fail if
>> can't connect */
>> +#define RPC_TASK_SENT  0x00000800  /* message
>> was sent */
>> +#define RPC_TASK_TIMEOUT  0x00001000  /* fail with
>> ETIMEDOUT on timeout */
>> +#define RPC_TASK_NOCONNECT  0x00002000  /* return
>> ENOTCONN if not connected */
>> +#define RPC_TASK_NO_RETRANS_TIMEOUT  0x00004000  /* wait
>> forever for a reply */
>> +#define RPC_TASK_CRED_NOREF  0x00008000  /* No
>> refcount on the credential */
>> 
>> #define RPC_IS_ASYNC(t)  ((t)->tk_flags &
>> RPC_TASK_ASYNC)
>> #define RPC_IS_SWAPPER(t)  ((t)->tk_flags & RPC_TASK_SWAPPER)
>> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
>> index a97d4e06cae3..476caa4ebf5c 100644
>> --- a/net/sunrpc/clnt.c
>> +++ b/net/sunrpc/clnt.c
>> @@ -1162,7 +1162,8 @@ EXPORT_SYMBOL_GPL(rpc_run_task);
>> * @msg: RPC call parameters
>> * @flags: RPC call flags
>> */
>> -int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message
>> *msg, int flags)
>> +int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message
>> *msg,
>> +  unsigned int flags)
>> {
>> struct rpc_task *task;
>> struct rpc_task_setup task_setup_data = {
>> @@ -1197,9 +1198,9 @@ EXPORT_SYMBOL_GPL(rpc_call_sync);
>> * @tk_ops: RPC call ops
>> * @data: user call data
>> */
>> -int
>> -rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg,
>> int flags,
>> -  const struct rpc_call_ops *tk_ops, void *data)
>> +int rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message
>> *msg,
>> +  unsigned int flags, const struct rpc_call_ops
>> *tk_ops,
>> +  void *data)
>> {
>> struct rpc_task *task;
>> struct rpc_task_setup task_setup_data = {
>> @@ -3080,7 +3081,7 @@ static void rpc_show_task(const struct rpc_clnt
>> *clnt,
>> if (RPC_IS_QUEUED(task))
>> rpc_waitq = rpc_qname(task->tk_waitqueue);
>> 
>> -  printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s
>> a:%ps q:%s\n",
>> +  printk(KERN_INFO "%5u %08x %6d %8p %8p %8ld %8p %sv%u %s
>> a:%ps q:%s\n",
>> task->tk_pid, task->tk_flags, task->tk_status,
>> clnt, task->tk_rqstp, rpc_task_timeout(task), task-
>>> tk_ops,
>> clnt->cl_program->name, clnt->cl_vers,
>> rpc_proc_name(task),
>> diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
>> index 8df634e63f30..60f20be4e7e5 100644
>> --- a/net/sunrpc/debugfs.c
>> +++ b/net/sunrpc/debugfs.c
>> @@ -30,7 +30,7 @@ tasks_show(struct seq_file *f, void *v)
>> if (task->tk_rqstp)
>> xid = be32_to_cpu(task->tk_rqstp->rq_xid);
>> 
>> -  seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps
>> q:%s\n",
>> +  seq_printf(f, "%5u %08x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps
>> q:%s\n",
>> task->tk_pid, task->tk_flags, task->tk_status,
>> clnt->cl_clid, xid, rpc_task_timeout(task), task-
>>> tk_ops,
>> clnt->cl_program->name, clnt->cl_vers,
>> rpc_proc_name(task),
>> 
>> 
> 
> -- 
> Trond Myklebust
> Linux NFS client maintainer, Hammerspace
> trond.myklebust@hammerspace.com

--
Chuck Lever
Trond Myklebust July 23, 2022, 8:10 p.m. UTC | #3
On Fri, 2022-07-22 at 17:55 +0000, Chuck Lever III wrote:
> 
> 
> > On Jul 22, 2022, at 1:53 PM, Trond Myklebust
> > <trondmy@hammerspace.com> wrote:
> > 
> > On Fri, 2022-07-22 at 13:25 -0400, Chuck Lever wrote:
> > > There is just one unused bit left in rpc_task::tk_flags, and I
> > > will
> > > need two in subsequent patches. Double the width of the field to
> > > accommodate more flag bits.
> > 
> > The values 0x8 and 0x40 are both free, so I'm not seeing why this
> > patch
> > is needed at this time.
> 
> It's not needed now, but as recently as last year, there were no free
> bits (and I needed them for RPC-with-TLS support at that time). We
> will
> have to widen this field sooner or later.
> 
> I don't have a problem dropping this one if you'd rather wait.
> 

I dropped it after applying the other v2 patches. As I said, I don't
see a need for this expansion yet, and if we do at some point run out
of bits, I can see other flags we can drop (RPC_TASK_ROOTCREDS and
RPC_TASK_NULLCREDS being obvious targets) before we need to consider
actually expanding the size of this field.

In fact, by not expanding it, we can trivially shrink the size of
struct rpc_task by 8 bytes on x86_64 simply by moving the field
tk_rpc_status to eliminate the current 4 byte hole. I've added a patch
to do just that.
Chuck Lever July 25, 2022, 1:17 p.m. UTC | #4
> On Jul 23, 2022, at 4:10 PM, Trond Myklebust <trondmy@hammerspace.com> wrote:
> 
> On Fri, 2022-07-22 at 17:55 +0000, Chuck Lever III wrote:
>> 
>> 
>>> On Jul 22, 2022, at 1:53 PM, Trond Myklebust
>>> <trondmy@hammerspace.com> wrote:
>>> 
>>> On Fri, 2022-07-22 at 13:25 -0400, Chuck Lever wrote:
>>>> There is just one unused bit left in rpc_task::tk_flags, and I
>>>> will
>>>> need two in subsequent patches. Double the width of the field to
>>>> accommodate more flag bits.
>>> 
>>> The values 0x8 and 0x40 are both free, so I'm not seeing why this
>>> patch
>>> is needed at this time.
>> 
>> It's not needed now, but as recently as last year, there were no free
>> bits (and I needed them for RPC-with-TLS support at that time). We
>> will
>> have to widen this field sooner or later.
>> 
>> I don't have a problem dropping this one if you'd rather wait.
>> 
> 
> I dropped it after applying the other v2 patches.

Thanks for applying the others; I'll drop this one from
my private tree.


> As I said, I don't
> see a need for this expansion yet, and if we do at some point run out
> of bits, I can see other flags we can drop (RPC_TASK_ROOTCREDS and
> RPC_TASK_NULLCREDS being obvious targets) before we need to consider
> actually expanding the size of this field.

Agreed, expanding the flags field is no longer necessary for
RPC-with-TLS, as I've converted it to use the layered connect
mechanism you suggested. The flag it waits on now is
XPRT_CONNECTED.


> In fact, by not expanding it, we can trivially shrink the size of
> struct rpc_task by 8 bytes on x86_64 simply by moving the field
> tk_rpc_status to eliminate the current 4 byte hole. I've added a patch
> to do just that.

--
Chuck Lever
diff mbox series

Patch

diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 90501404fa49..cbdd20dc84b7 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -193,11 +193,13 @@  void rpc_prepare_reply_pages(struct rpc_rqst *req, struct page **pages,
 			     unsigned int hdrsize);
 void		rpc_call_start(struct rpc_task *);
 int		rpc_call_async(struct rpc_clnt *clnt,
-			       const struct rpc_message *msg, int flags,
+			       const struct rpc_message *msg,
+			       unsigned int flags,
 			       const struct rpc_call_ops *tk_ops,
 			       void *calldata);
 int		rpc_call_sync(struct rpc_clnt *clnt,
-			      const struct rpc_message *msg, int flags);
+			      const struct rpc_message *msg,
+			      unsigned int flags);
 struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
 			       int flags);
 int		rpc_restart_call_prepare(struct rpc_task *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 1d7a3e51b795..d4b7ebd0a99c 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -82,7 +82,7 @@  struct rpc_task {
 	ktime_t			tk_start;	/* RPC task init timestamp */
 
 	pid_t			tk_owner;	/* Process id for batching tasks */
-	unsigned short		tk_flags;	/* misc flags */
+	unsigned int		tk_flags;	/* misc flags */
 	unsigned short		tk_timeouts;	/* maj timeouts */
 
 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
@@ -112,27 +112,27 @@  struct rpc_task_setup {
 	const struct rpc_call_ops *callback_ops;
 	void *callback_data;
 	struct workqueue_struct *workqueue;
-	unsigned short flags;
+	unsigned int flags;
 	signed char priority;
 };
 
 /*
  * RPC task flags
  */
-#define RPC_TASK_ASYNC		0x0001		/* is an async task */
-#define RPC_TASK_SWAPPER	0x0002		/* is swapping in/out */
-#define RPC_TASK_MOVEABLE	0x0004		/* nfs4.1+ rpc tasks */
-#define RPC_TASK_NULLCREDS	0x0010		/* Use AUTH_NULL credential */
-#define RPC_CALL_MAJORSEEN	0x0020		/* major timeout seen */
-#define RPC_TASK_DYNAMIC	0x0080		/* task was kmalloc'ed */
-#define	RPC_TASK_NO_ROUND_ROBIN	0x0100		/* send requests on "main" xprt */
-#define RPC_TASK_SOFT		0x0200		/* Use soft timeouts */
-#define RPC_TASK_SOFTCONN	0x0400		/* Fail if can't connect */
-#define RPC_TASK_SENT		0x0800		/* message was sent */
-#define RPC_TASK_TIMEOUT	0x1000		/* fail with ETIMEDOUT on timeout */
-#define RPC_TASK_NOCONNECT	0x2000		/* return ENOTCONN if not connected */
-#define RPC_TASK_NO_RETRANS_TIMEOUT	0x4000		/* wait forever for a reply */
-#define RPC_TASK_CRED_NOREF	0x8000		/* No refcount on the credential */
+#define RPC_TASK_ASYNC			0x00000001	/* is an async task */
+#define RPC_TASK_SWAPPER		0x00000002	/* is swapping in/out */
+#define RPC_TASK_MOVEABLE		0x00000004	/* nfs4.1+ rpc tasks */
+#define RPC_TASK_NULLCREDS		0x00000010	/* Use AUTH_NULL credential */
+#define RPC_CALL_MAJORSEEN		0x00000020	/* major timeout seen */
+#define RPC_TASK_DYNAMIC		0x00000080	/* task was kmalloc'ed */
+#define	RPC_TASK_NO_ROUND_ROBIN		0x00000100	/* send requests on "main" xprt */
+#define RPC_TASK_SOFT			0x00000200	/* Use soft timeouts */
+#define RPC_TASK_SOFTCONN		0x00000400	/* Fail if can't connect */
+#define RPC_TASK_SENT			0x00000800	/* message was sent */
+#define RPC_TASK_TIMEOUT		0x00001000	/* fail with ETIMEDOUT on timeout */
+#define RPC_TASK_NOCONNECT		0x00002000	/* return ENOTCONN if not connected */
+#define RPC_TASK_NO_RETRANS_TIMEOUT	0x00004000	/* wait forever for a reply */
+#define RPC_TASK_CRED_NOREF		0x00008000	/* No refcount on the credential */
 
 #define RPC_IS_ASYNC(t)		((t)->tk_flags & RPC_TASK_ASYNC)
 #define RPC_IS_SWAPPER(t)	((t)->tk_flags & RPC_TASK_SWAPPER)
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index a97d4e06cae3..476caa4ebf5c 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -1162,7 +1162,8 @@  EXPORT_SYMBOL_GPL(rpc_run_task);
  * @msg: RPC call parameters
  * @flags: RPC call flags
  */
-int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags)
+int rpc_call_sync(struct rpc_clnt *clnt, const struct rpc_message *msg,
+		  unsigned int flags)
 {
 	struct rpc_task	*task;
 	struct rpc_task_setup task_setup_data = {
@@ -1197,9 +1198,9 @@  EXPORT_SYMBOL_GPL(rpc_call_sync);
  * @tk_ops: RPC call ops
  * @data: user call data
  */
-int
-rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags,
-	       const struct rpc_call_ops *tk_ops, void *data)
+int rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg,
+		   unsigned int flags, const struct rpc_call_ops *tk_ops,
+		   void *data)
 {
 	struct rpc_task	*task;
 	struct rpc_task_setup task_setup_data = {
@@ -3080,7 +3081,7 @@  static void rpc_show_task(const struct rpc_clnt *clnt,
 	if (RPC_IS_QUEUED(task))
 		rpc_waitq = rpc_qname(task->tk_waitqueue);
 
-	printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n",
+	printk(KERN_INFO "%5u %08x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n",
 		task->tk_pid, task->tk_flags, task->tk_status,
 		clnt, task->tk_rqstp, rpc_task_timeout(task), task->tk_ops,
 		clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task),
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
index 8df634e63f30..60f20be4e7e5 100644
--- a/net/sunrpc/debugfs.c
+++ b/net/sunrpc/debugfs.c
@@ -30,7 +30,7 @@  tasks_show(struct seq_file *f, void *v)
 	if (task->tk_rqstp)
 		xid = be32_to_cpu(task->tk_rqstp->rq_xid);
 
-	seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n",
+	seq_printf(f, "%5u %08x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n",
 		task->tk_pid, task->tk_flags, task->tk_status,
 		clnt->cl_clid, xid, rpc_task_timeout(task), task->tk_ops,
 		clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task),