Quantcast

Sync nfs_connect w/ sys_connect

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Sync nfs_connect w/ sys_connect

Martin Pieuchot
This code is mostly a copy of what's done in sys_connect(), so sync it
to use solock()/sosleep()/sounlock() instead of splsoftnet()/splx().

ok?

Index: nfs/nfs_socket.c
===================================================================
RCS file: /cvs/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.114
diff -u -p -r1.114 nfs_socket.c
--- nfs/nfs_socket.c 3 Mar 2017 09:41:20 -0000 1.114
+++ nfs/nfs_socket.c 7 Mar 2017 09:53:02 -0000
@@ -306,25 +306,24 @@ nfs_connect(struct nfsmount *nmp, struct
  * connect system call but with the wait timing out so
  * that interruptible mounts don't hang here for a long time.
  */
- s = splsoftnet();
+ s = solock(so);
  while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
- (void) tsleep((caddr_t)&so->so_timeo, PSOCK,
- "nfscon", 2 * hz);
+ sosleep(so, &so->so_timeo, PSOCK, "nfscon", 2 * hz);
  if ((so->so_state & SS_ISCONNECTING) &&
     so->so_error == 0 && rep &&
     (error = nfs_sigintr(nmp, rep, rep->r_procp)) != 0){
  so->so_state &= ~SS_ISCONNECTING;
- splx(s);
+ sounlock(s);
  goto bad;
  }
  }
  if (so->so_error) {
  error = so->so_error;
  so->so_error = 0;
- splx(s);
+ sounlock(s);
  goto bad;
  }
- splx(s);
+ sounlock(s);
  }
  /*
  * Always set receive timeout to detect server crash and reconnect.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sync nfs_connect w/ sys_connect

Martin Pieuchot
On 07/03/17(Tue) 10:57, Martin Pieuchot wrote:
> This code is mostly a copy of what's done in sys_connect(), so sync it
> to use solock()/sosleep()/sounlock() instead of splsoftnet()/splx().
>
> ok?

Anyone?

>
> Index: nfs/nfs_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/nfs/nfs_socket.c,v
> retrieving revision 1.114
> diff -u -p -r1.114 nfs_socket.c
> --- nfs/nfs_socket.c 3 Mar 2017 09:41:20 -0000 1.114
> +++ nfs/nfs_socket.c 7 Mar 2017 09:53:02 -0000
> @@ -306,25 +306,24 @@ nfs_connect(struct nfsmount *nmp, struct
>   * connect system call but with the wait timing out so
>   * that interruptible mounts don't hang here for a long time.
>   */
> - s = splsoftnet();
> + s = solock(so);
>   while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
> - (void) tsleep((caddr_t)&so->so_timeo, PSOCK,
> - "nfscon", 2 * hz);
> + sosleep(so, &so->so_timeo, PSOCK, "nfscon", 2 * hz);
>   if ((so->so_state & SS_ISCONNECTING) &&
>      so->so_error == 0 && rep &&
>      (error = nfs_sigintr(nmp, rep, rep->r_procp)) != 0){
>   so->so_state &= ~SS_ISCONNECTING;
> - splx(s);
> + sounlock(s);
>   goto bad;
>   }
>   }
>   if (so->so_error) {
>   error = so->so_error;
>   so->so_error = 0;
> - splx(s);
> + sounlock(s);
>   goto bad;
>   }
> - splx(s);
> + sounlock(s);
>   }
>   /*
>   * Always set receive timeout to detect server crash and reconnect.
>

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Sync nfs_connect w/ sys_connect

Alexander Bluhm
In reply to this post by Martin Pieuchot
On Tue, Mar 07, 2017 at 10:57:52AM +0100, Martin Pieuchot wrote:
> This code is mostly a copy of what's done in sys_connect(), so sync it
> to use solock()/sosleep()/sounlock() instead of splsoftnet()/splx().
>
> ok?

OK bluhm@

>
> Index: nfs/nfs_socket.c
> ===================================================================
> RCS file: /cvs/src/sys/nfs/nfs_socket.c,v
> retrieving revision 1.114
> diff -u -p -r1.114 nfs_socket.c
> --- nfs/nfs_socket.c 3 Mar 2017 09:41:20 -0000 1.114
> +++ nfs/nfs_socket.c 7 Mar 2017 09:53:02 -0000
> @@ -306,25 +306,24 @@ nfs_connect(struct nfsmount *nmp, struct
>   * connect system call but with the wait timing out so
>   * that interruptible mounts don't hang here for a long time.
>   */
> - s = splsoftnet();
> + s = solock(so);
>   while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
> - (void) tsleep((caddr_t)&so->so_timeo, PSOCK,
> - "nfscon", 2 * hz);
> + sosleep(so, &so->so_timeo, PSOCK, "nfscon", 2 * hz);
>   if ((so->so_state & SS_ISCONNECTING) &&
>      so->so_error == 0 && rep &&
>      (error = nfs_sigintr(nmp, rep, rep->r_procp)) != 0){
>   so->so_state &= ~SS_ISCONNECTING;
> - splx(s);
> + sounlock(s);
>   goto bad;
>   }
>   }
>   if (so->so_error) {
>   error = so->so_error;
>   so->so_error = 0;
> - splx(s);
> + sounlock(s);
>   goto bad;
>   }
> - splx(s);
> + sounlock(s);
>   }
>   /*
>   * Always set receive timeout to detect server crash and reconnect.

Loading...