mbox series

[RFC,0/7] SUNRPC: Create sysfs files for changing IP

Message ID 20210111214143.553479-1-Anna.Schumaker@Netapp.com (mailing list archive)
Headers show
Series SUNRPC: Create sysfs files for changing IP | expand

Message

Anna Schumaker Jan. 11, 2021, 9:41 p.m. UTC
From: Anna Schumaker <Anna.Schumaker@Netapp.com>

It's possible for an NFS server to go down but come back up with a
different IP address. These patches provide a way for administrators to
handle this issue by providing a new IP address for xprt sockets to
connect to.

This is a first draft of the code, so any thoughts or suggestions would
be greatly appreciated!

Anna


Anna Schumaker (7):
  net: Add a /sys/net directory to sysfs
  sunrpc: Create a sunrpc directory under /sys/net/
  sunrpc: Create a net/ subdirectory in the sunrpc sysfs
  sunrpc: Create per-rpc_clnt sysfs kobjects
  sunrpc: Create a per-rpc_clnt file for managing the IP address
  sunrpc: Prepare xs_connect() for taking NULL tasks
  sunrpc: Connect to a new IP address provided by the user

 include/linux/sunrpc/clnt.h |   1 +
 include/net/sock.h          |   4 +
 net/socket.c                |   8 ++
 net/sunrpc/Makefile         |   2 +-
 net/sunrpc/clnt.c           |   5 ++
 net/sunrpc/sunrpc_syms.c    |   8 ++
 net/sunrpc/sysfs.c          | 160 ++++++++++++++++++++++++++++++++++++
 net/sunrpc/sysfs.h          |  22 +++++
 net/sunrpc/xprtsock.c       |   3 +-
 9 files changed, 211 insertions(+), 2 deletions(-)
 create mode 100644 net/sunrpc/sysfs.c
 create mode 100644 net/sunrpc/sysfs.h

Comments

Chuck Lever Jan. 12, 2021, 1:09 p.m. UTC | #1
Hi Anna-

> On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
> 
> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> 
> It's possible for an NFS server to go down but come back up with a
> different IP address. These patches provide a way for administrators to
> handle this issue by providing a new IP address for xprt sockets to
> connect to.
> 
> This is a first draft of the code, so any thoughts or suggestions would
> be greatly appreciated!

One implementation question, one future question.

Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?

Do you have a plan to integrate support for fs_locations to probe
servers for alternate IP addresses? Would that be a userspace
utility that would plug values into this new /sys API?


> Anna
> 
> 
> Anna Schumaker (7):
>  net: Add a /sys/net directory to sysfs
>  sunrpc: Create a sunrpc directory under /sys/net/
>  sunrpc: Create a net/ subdirectory in the sunrpc sysfs
>  sunrpc: Create per-rpc_clnt sysfs kobjects
>  sunrpc: Create a per-rpc_clnt file for managing the IP address
>  sunrpc: Prepare xs_connect() for taking NULL tasks
>  sunrpc: Connect to a new IP address provided by the user
> 
> include/linux/sunrpc/clnt.h |   1 +
> include/net/sock.h          |   4 +
> net/socket.c                |   8 ++
> net/sunrpc/Makefile         |   2 +-
> net/sunrpc/clnt.c           |   5 ++
> net/sunrpc/sunrpc_syms.c    |   8 ++
> net/sunrpc/sysfs.c          | 160 ++++++++++++++++++++++++++++++++++++
> net/sunrpc/sysfs.h          |  22 +++++
> net/sunrpc/xprtsock.c       |   3 +-
> 9 files changed, 211 insertions(+), 2 deletions(-)
> create mode 100644 net/sunrpc/sysfs.c
> create mode 100644 net/sunrpc/sysfs.h
> 
> -- 
> 2.29.2
> 

--
Chuck Lever
J. Bruce Fields Jan. 12, 2021, 4:59 p.m. UTC | #2
On Tue, Jan 12, 2021 at 08:09:09AM -0500, Chuck Lever wrote:
> Hi Anna-
> 
> > On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
> > 
> > From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > 
> > It's possible for an NFS server to go down but come back up with a
> > different IP address. These patches provide a way for administrators to
> > handle this issue by providing a new IP address for xprt sockets to
> > connect to.
> > 
> > This is a first draft of the code, so any thoughts or suggestions would
> > be greatly appreciated!
> 
> One implementation question, one future question.
> 
> Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?
> 
> Do you have a plan to integrate support for fs_locations to probe
> servers for alternate IP addresses? Would that be a userspace
> utility that would plug values into this new /sys API?

We already have dns resolution for fs_locations, right?  Why can't we
use that here?  Is it that the mount call doesn't give us a host name?
Or we don't trust dns to have the updated IP address for some reason?

--b.

> 
> 
> > Anna
> > 
> > 
> > Anna Schumaker (7):
> >  net: Add a /sys/net directory to sysfs
> >  sunrpc: Create a sunrpc directory under /sys/net/
> >  sunrpc: Create a net/ subdirectory in the sunrpc sysfs
> >  sunrpc: Create per-rpc_clnt sysfs kobjects
> >  sunrpc: Create a per-rpc_clnt file for managing the IP address
> >  sunrpc: Prepare xs_connect() for taking NULL tasks
> >  sunrpc: Connect to a new IP address provided by the user
> > 
> > include/linux/sunrpc/clnt.h |   1 +
> > include/net/sock.h          |   4 +
> > net/socket.c                |   8 ++
> > net/sunrpc/Makefile         |   2 +-
> > net/sunrpc/clnt.c           |   5 ++
> > net/sunrpc/sunrpc_syms.c    |   8 ++
> > net/sunrpc/sysfs.c          | 160 ++++++++++++++++++++++++++++++++++++
> > net/sunrpc/sysfs.h          |  22 +++++
> > net/sunrpc/xprtsock.c       |   3 +-
> > 9 files changed, 211 insertions(+), 2 deletions(-)
> > create mode 100644 net/sunrpc/sysfs.c
> > create mode 100644 net/sunrpc/sysfs.h
> > 
> > -- 
> > 2.29.2
> > 
> 
> --
> Chuck Lever
> 
>
Anna Schumaker Jan. 13, 2021, 7:23 p.m. UTC | #3
On Tue, Jan 12, 2021 at 11:59 AM J. Bruce Fields <bfields@fieldses.org> wrote:
>
> On Tue, Jan 12, 2021 at 08:09:09AM -0500, Chuck Lever wrote:
> > Hi Anna-
> >
> > > On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
> > >
> > > From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> > >
> > > It's possible for an NFS server to go down but come back up with a
> > > different IP address. These patches provide a way for administrators to
> > > handle this issue by providing a new IP address for xprt sockets to
> > > connect to.
> > >
> > > This is a first draft of the code, so any thoughts or suggestions would
> > > be greatly appreciated!
> >
> > One implementation question, one future question.
> >
> > Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?

Possibly! I was trying to match /sys/fs/nfs, but I can definitely
change this if another location is better.

> >
> > Do you have a plan to integrate support for fs_locations to probe
> > servers for alternate IP addresses? Would that be a userspace
> > utility that would plug values into this new /sys API?

Yeah, I would expect there to be a new utility to help with assigning
new values. I haven't given any thought to using fs_locations yet, but
it could probably work.
>
> We already have dns resolution for fs_locations, right?  Why can't we
> use that here?  Is it that the mount call doesn't give us a host name?
> Or we don't trust dns to have the updated IP address for some reason?

The mount call doesn't give us a host name (that I can find, at
least). By the time we get to the sunrpc layer we're dealing with just
the IP address anyway. I'd expect there to be a userland utility to
translate the dns name to the new IP address and pass it along to the
new API.

Anna
>
> --b.
>
> >
> >
> > > Anna
> > >
> > >
> > > Anna Schumaker (7):
> > >  net: Add a /sys/net directory to sysfs
> > >  sunrpc: Create a sunrpc directory under /sys/net/
> > >  sunrpc: Create a net/ subdirectory in the sunrpc sysfs
> > >  sunrpc: Create per-rpc_clnt sysfs kobjects
> > >  sunrpc: Create a per-rpc_clnt file for managing the IP address
> > >  sunrpc: Prepare xs_connect() for taking NULL tasks
> > >  sunrpc: Connect to a new IP address provided by the user
> > >
> > > include/linux/sunrpc/clnt.h |   1 +
> > > include/net/sock.h          |   4 +
> > > net/socket.c                |   8 ++
> > > net/sunrpc/Makefile         |   2 +-
> > > net/sunrpc/clnt.c           |   5 ++
> > > net/sunrpc/sunrpc_syms.c    |   8 ++
> > > net/sunrpc/sysfs.c          | 160 ++++++++++++++++++++++++++++++++++++
> > > net/sunrpc/sysfs.h          |  22 +++++
> > > net/sunrpc/xprtsock.c       |   3 +-
> > > 9 files changed, 211 insertions(+), 2 deletions(-)
> > > create mode 100644 net/sunrpc/sysfs.c
> > > create mode 100644 net/sunrpc/sysfs.h
> > >
> > > --
> > > 2.29.2
> > >
> >
> > --
> > Chuck Lever
> >
> >
Chuck Lever Jan. 13, 2021, 7:48 p.m. UTC | #4
> On Jan 13, 2021, at 2:23 PM, Anna Schumaker <schumaker.anna@gmail.com> wrote:
> 
> On Tue, Jan 12, 2021 at 11:59 AM J. Bruce Fields <bfields@fieldses.org> wrote:
>> 
>> On Tue, Jan 12, 2021 at 08:09:09AM -0500, Chuck Lever wrote:
>>> Hi Anna-
>>> 
>>>> On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
>>>> 
>>>> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
>>>> 
>>>> It's possible for an NFS server to go down but come back up with a
>>>> different IP address. These patches provide a way for administrators to
>>>> handle this issue by providing a new IP address for xprt sockets to
>>>> connect to.
>>>> 
>>>> This is a first draft of the code, so any thoughts or suggestions would
>>>> be greatly appreciated!
>>> 
>>> One implementation question, one future question.
>>> 
>>> Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?
> 
> Possibly! I was trying to match /sys/fs/nfs, but I can definitely
> change this if another location is better.

Ah... since this is a supplement to the mount() interface, maybe
placing this new API under /sys/fs/nfs/ might make some sense.


>>> Do you have a plan to integrate support for fs_locations to probe
>>> servers for alternate IP addresses? Would that be a userspace
>>> utility that would plug values into this new /sys API?
> 
> Yeah, I would expect there to be a new utility to help with assigning
> new values. I haven't given any thought to using fs_locations yet, but
> it could probably work.

I could see a tool that performs an fs_locations from user space
and plugs that information into the kernel NFS client as needed.
Future work!


--
Chuck Lever
Chuck Lever Jan. 13, 2021, 9:23 p.m. UTC | #5
> On Jan 13, 2021, at 2:48 PM, Chuck Lever <chuck.lever@oracle.com> wrote:
> 
>> On Jan 13, 2021, at 2:23 PM, Anna Schumaker <schumaker.anna@gmail.com> wrote:
>> 
>> On Tue, Jan 12, 2021 at 11:59 AM J. Bruce Fields <bfields@fieldses.org> wrote:
>>> 
>>> On Tue, Jan 12, 2021 at 08:09:09AM -0500, Chuck Lever wrote:
>>>> Hi Anna-
>>>> 
>>>>> On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
>>>>> 
>>>>> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
>>>>> 
>>>>> It's possible for an NFS server to go down but come back up with a
>>>>> different IP address. These patches provide a way for administrators to
>>>>> handle this issue by providing a new IP address for xprt sockets to
>>>>> connect to.
>>>>> 
>>>>> This is a first draft of the code, so any thoughts or suggestions would
>>>>> be greatly appreciated!
>>>> 
>>>> One implementation question, one future question.
>>>> 
>>>> Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?
>> 
>> Possibly! I was trying to match /sys/fs/nfs, but I can definitely
>> change this if another location is better.
> 
> Ah... since this is a supplement to the mount() interface, maybe
> placing this new API under /sys/fs/nfs/ might make some sense.

Or you could implement it with "-o remount,addr=new-address".


--
Chuck Lever
Olga Kornievskaia Jan. 14, 2021, 8:29 p.m. UTC | #6
On Wed, Jan 13, 2021 at 9:18 PM Chuck Lever <chuck.lever@oracle.com> wrote:
>
>
> > On Jan 13, 2021, at 2:48 PM, Chuck Lever <chuck.lever@oracle.com> wrote:
> >
> >> On Jan 13, 2021, at 2:23 PM, Anna Schumaker <schumaker.anna@gmail.com> wrote:
> >>
> >> On Tue, Jan 12, 2021 at 11:59 AM J. Bruce Fields <bfields@fieldses.org> wrote:
> >>>
> >>> On Tue, Jan 12, 2021 at 08:09:09AM -0500, Chuck Lever wrote:
> >>>> Hi Anna-
> >>>>
> >>>>> On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
> >>>>>
> >>>>> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
> >>>>>
> >>>>> It's possible for an NFS server to go down but come back up with a
> >>>>> different IP address. These patches provide a way for administrators to
> >>>>> handle this issue by providing a new IP address for xprt sockets to
> >>>>> connect to.
> >>>>>
> >>>>> This is a first draft of the code, so any thoughts or suggestions would
> >>>>> be greatly appreciated!
> >>>>
> >>>> One implementation question, one future question.
> >>>>
> >>>> Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?
> >>
> >> Possibly! I was trying to match /sys/fs/nfs, but I can definitely
> >> change this if another location is better.
> >
> > Ah... since this is a supplement to the mount() interface, maybe
> > placing this new API under /sys/fs/nfs/ might make some sense.
>
> Or you could implement it with "-o remount,addr=new-address".

A change of address is currently not allowed by the NFS because
multiple mounts might be sharing a superblock and change of one
mount's option would not be correct. The way things work from this new
mechanism is system wide and all mounts are affected.


>
>
> --
> Chuck Lever
>
>
>
Chuck Lever Jan. 19, 2021, 3:55 p.m. UTC | #7
> On Jan 14, 2021, at 3:29 PM, Olga Kornievskaia <aglo@umich.edu> wrote:
> 
> On Wed, Jan 13, 2021 at 9:18 PM Chuck Lever <chuck.lever@oracle.com> wrote:
>> 
>> 
>>> On Jan 13, 2021, at 2:48 PM, Chuck Lever <chuck.lever@oracle.com> wrote:
>>> 
>>>> On Jan 13, 2021, at 2:23 PM, Anna Schumaker <schumaker.anna@gmail.com> wrote:
>>>> 
>>>> On Tue, Jan 12, 2021 at 11:59 AM J. Bruce Fields <bfields@fieldses.org> wrote:
>>>>> 
>>>>> On Tue, Jan 12, 2021 at 08:09:09AM -0500, Chuck Lever wrote:
>>>>>> Hi Anna-
>>>>>> 
>>>>>>> On Jan 11, 2021, at 4:41 PM, schumaker.anna@gmail.com wrote:
>>>>>>> 
>>>>>>> From: Anna Schumaker <Anna.Schumaker@Netapp.com>
>>>>>>> 
>>>>>>> It's possible for an NFS server to go down but come back up with a
>>>>>>> different IP address. These patches provide a way for administrators to
>>>>>>> handle this issue by providing a new IP address for xprt sockets to
>>>>>>> connect to.
>>>>>>> 
>>>>>>> This is a first draft of the code, so any thoughts or suggestions would
>>>>>>> be greatly appreciated!
>>>>>> 
>>>>>> One implementation question, one future question.
>>>>>> 
>>>>>> Would /sys/kernel/net be a little better? or /sys/kernel/sunrpc ?
>>>> 
>>>> Possibly! I was trying to match /sys/fs/nfs, but I can definitely
>>>> change this if another location is better.
>>> 
>>> Ah... since this is a supplement to the mount() interface, maybe
>>> placing this new API under /sys/fs/nfs/ might make some sense.
>> 
>> Or you could implement it with "-o remount,addr=new-address".
> 
> A change of address is currently not allowed by the NFS because
> multiple mounts might be sharing a superblock and change of one
> mount's option would not be correct. The way things work from this new
> mechanism is system wide and all mounts are affected.

OK, well, if we're going with an API based on /sys that shows
underlying transport connections, is there a way to expose
whether the connection is established or closed? Maybe also
last traffic or last connect attempt?

Can it support RPC/RDMA connections too?


--
Chuck Lever