[v5,1/9] NFSD fill-in netloc4 structure
diff mbox series

Message ID 20190808201848.36640-2-olga.kornievskaia@gmail.com
State New
Headers show
Series
  • server-side support for "inter" SSC copy
Related show

Commit Message

Olga Kornievskaia Aug. 8, 2019, 8:18 p.m. UTC
From: Olga Kornievskaia <kolga@netapp.com>

nfs.4 defines nfs42_netaddr structure that represents netloc4.

Populate needed fields from the sockaddr structure.

This will be used by flexfiles and 4.2 inter copy

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfsd/nfsd.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Olga Kornievskaia Aug. 12, 2019, 4:12 p.m. UTC | #1
Hi Bruce,

I believe I'm getting this because as it has been before NFSD patches
depend on client-side patches (or specifically) it needed
https://patchwork.kernel.org/patch/10649667/

I should have included the patch in both the client and server patch
series. How should I correct this?

Also, in general (to run things) nfsd patches need the client side
patches to be functional destination server (destination server nfs
client piece).



On Sun, Aug 11, 2019 at 1:49 AM kbuild test robot <lkp@intel.com> wrote:
>
> Hi Olga,
>
> Thank you for the patch! Yet something to improve:
>
> [auto build test ERROR on nfsd/nfsd-next]
> [cannot apply to v5.3-rc3 next-20190809]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Olga-Kornievskaia/server-side-support-for-inter-SSC-copy/20190811-120551
> base:   git://linux-nfs.org/~bfields/linux.git nfsd-next
> config: x86_64-lkp (attached as .config)
> compiler: gcc-7 (Debian 7.4.0-10) 7.4.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All error/warnings (new ones prefixed by >>):
>
>    In file included from fs/nfsd/state.h:42:0,
>                     from fs/nfsd/trace.h:128,
>                     from fs/nfsd/trace.c:3:
> >> fs/nfsd/nfsd.h:391:16: warning: 'struct nfs42_netaddr' declared inside parameter list will not be visible outside of this definition or declaration
>             struct nfs42_netaddr *netaddr)
>                    ^~~~~~~~~~~~~
>    fs/nfsd/nfsd.h: In function 'nfsd4_set_netaddr':
> >> fs/nfsd/nfsd.h:401:18: error: dereferencing pointer to incomplete type 'struct nfs42_netaddr'
>       sprintf(netaddr->netid, "tcp");
>                      ^~
>
> vim +401 fs/nfsd/nfsd.h
>
>    389
>    390  static inline u32 nfsd4_set_netaddr(struct sockaddr *addr,
>  > 391                                      struct nfs42_netaddr *netaddr)
>    392  {
>    393          struct sockaddr_in *sin = (struct sockaddr_in *)addr;
>    394          struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr;
>    395          unsigned int port;
>    396          size_t ret_addr, ret_port;
>    397
>    398          switch (addr->sa_family) {
>    399          case AF_INET:
>    400                  port = ntohs(sin->sin_port);
>  > 401                  sprintf(netaddr->netid, "tcp");
>    402                  netaddr->netid_len = 3;
>    403                  break;
>    404          case AF_INET6:
>    405                  port = ntohs(sin6->sin6_port);
>    406                  sprintf(netaddr->netid, "tcp6");
>    407                  netaddr->netid_len = 4;
>    408                  break;
>    409          default:
>    410                  return nfserr_inval;
>    411          }
>    412          ret_addr = rpc_ntop(addr, netaddr->addr, sizeof(netaddr->addr));
>    413          ret_port = snprintf(netaddr->addr + ret_addr,
>    414                              RPCBIND_MAXUADDRLEN + 1 - ret_addr,
>    415                              ".%u.%u", port >> 8, port & 0xff);
>    416          WARN_ON(ret_port >= RPCBIND_MAXUADDRLEN + 1 - ret_addr);
>    417          netaddr->addr_len = ret_addr + ret_port;
>    418          return 0;
>    419  }
>    420
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
J. Bruce Fields Aug. 12, 2019, 7:58 p.m. UTC | #2
On Mon, Aug 12, 2019 at 12:12:33PM -0400, Olga Kornievskaia wrote:
> Hi Bruce,
> 
> I believe I'm getting this because as it has been before NFSD patches
> depend on client-side patches (or specifically) it needed
> https://patchwork.kernel.org/patch/10649667/
> 
> I should have included the patch in both the client and server patch
> series. How should I correct this?
> 
> Also, in general (to run things) nfsd patches need the client side
> patches to be functional destination server (destination server nfs
> client piece).

I think I'd just sent it all as one series.  You can note in the cover
letter that the first X patches are for the client and the rest for the
server, if you'd like.

--b.

> On Sun, Aug 11, 2019 at 1:49 AM kbuild test robot <lkp@intel.com> wrote:
> >
> > Hi Olga,
> >
> > Thank you for the patch! Yet something to improve:
> >
> > [auto build test ERROR on nfsd/nfsd-next]
> > [cannot apply to v5.3-rc3 next-20190809]
> > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >
> > url:    https://github.com/0day-ci/linux/commits/Olga-Kornievskaia/server-side-support-for-inter-SSC-copy/20190811-120551
> > base:   git://linux-nfs.org/~bfields/linux.git nfsd-next
> > config: x86_64-lkp (attached as .config)
> > compiler: gcc-7 (Debian 7.4.0-10) 7.4.0
> > reproduce:
> >         # save the attached .config to linux build tree
> >         make ARCH=x86_64
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> > All error/warnings (new ones prefixed by >>):
> >
> >    In file included from fs/nfsd/state.h:42:0,
> >                     from fs/nfsd/trace.h:128,
> >                     from fs/nfsd/trace.c:3:
> > >> fs/nfsd/nfsd.h:391:16: warning: 'struct nfs42_netaddr' declared inside parameter list will not be visible outside of this definition or declaration
> >             struct nfs42_netaddr *netaddr)
> >                    ^~~~~~~~~~~~~
> >    fs/nfsd/nfsd.h: In function 'nfsd4_set_netaddr':
> > >> fs/nfsd/nfsd.h:401:18: error: dereferencing pointer to incomplete type 'struct nfs42_netaddr'
> >       sprintf(netaddr->netid, "tcp");
> >                      ^~
> >
> > vim +401 fs/nfsd/nfsd.h
> >
> >    389
> >    390  static inline u32 nfsd4_set_netaddr(struct sockaddr *addr,
> >  > 391                                      struct nfs42_netaddr *netaddr)
> >    392  {
> >    393          struct sockaddr_in *sin = (struct sockaddr_in *)addr;
> >    394          struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr;
> >    395          unsigned int port;
> >    396          size_t ret_addr, ret_port;
> >    397
> >    398          switch (addr->sa_family) {
> >    399          case AF_INET:
> >    400                  port = ntohs(sin->sin_port);
> >  > 401                  sprintf(netaddr->netid, "tcp");
> >    402                  netaddr->netid_len = 3;
> >    403                  break;
> >    404          case AF_INET6:
> >    405                  port = ntohs(sin6->sin6_port);
> >    406                  sprintf(netaddr->netid, "tcp6");
> >    407                  netaddr->netid_len = 4;
> >    408                  break;
> >    409          default:
> >    410                  return nfserr_inval;
> >    411          }
> >    412          ret_addr = rpc_ntop(addr, netaddr->addr, sizeof(netaddr->addr));
> >    413          ret_port = snprintf(netaddr->addr + ret_addr,
> >    414                              RPCBIND_MAXUADDRLEN + 1 - ret_addr,
> >    415                              ".%u.%u", port >> 8, port & 0xff);
> >    416          WARN_ON(ret_port >= RPCBIND_MAXUADDRLEN + 1 - ret_addr);
> >    417          netaddr->addr_len = ret_addr + ret_port;
> >    418          return 0;
> >    419  }
> >    420
> >
> > ---
> > 0-DAY kernel test infrastructure                Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Patch
diff mbox series

diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index af29475..687f8e1 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -19,6 +19,7 @@ 
 #include <linux/sunrpc/svc.h>
 #include <linux/sunrpc/svc_xprt.h>
 #include <linux/sunrpc/msg_prot.h>
+#include <linux/sunrpc/addr.h>
 
 #include <uapi/linux/nfsd/debug.h>
 
@@ -386,6 +387,37 @@  static inline bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
 
 extern const u32 nfsd_suppattrs[3][3];
 
+static inline u32 nfsd4_set_netaddr(struct sockaddr *addr,
+				    struct nfs42_netaddr *netaddr)
+{
+	struct sockaddr_in *sin = (struct sockaddr_in *)addr;
+	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr;
+	unsigned int port;
+	size_t ret_addr, ret_port;
+
+	switch (addr->sa_family) {
+	case AF_INET:
+		port = ntohs(sin->sin_port);
+		sprintf(netaddr->netid, "tcp");
+		netaddr->netid_len = 3;
+		break;
+	case AF_INET6:
+		port = ntohs(sin6->sin6_port);
+		sprintf(netaddr->netid, "tcp6");
+		netaddr->netid_len = 4;
+		break;
+	default:
+		return nfserr_inval;
+	}
+	ret_addr = rpc_ntop(addr, netaddr->addr, sizeof(netaddr->addr));
+	ret_port = snprintf(netaddr->addr + ret_addr,
+			    RPCBIND_MAXUADDRLEN + 1 - ret_addr,
+			    ".%u.%u", port >> 8, port & 0xff);
+	WARN_ON(ret_port >= RPCBIND_MAXUADDRLEN + 1 - ret_addr);
+	netaddr->addr_len = ret_addr + ret_port;
+	return 0;
+}
+
 static inline bool bmval_is_subset(const u32 *bm1, const u32 *bm2)
 {
 	return !((bm1[0] & ~bm2[0]) ||