The nfs_quick_reply() function needs to know the current RPC transport
authorzoulasc <christos@zoulas.com>
Thu, 3 Mar 2016 18:24:10 +0000 (13:24 -0500)
committerzoulasc <christos@zoulas.com>
Thu, 3 Mar 2016 18:24:10 +0000 (13:24 -0500)
outside of the NFS LOOKUP method call. It needs this to reply to the
NFS LOOKUP call that initiated the mount.

Now there are functions that avoid transport corruption if another
request comes in during the backgroud mount make nfs_quick_reply()
use them.

From: Ian Kent

amd/amfs_generic.c
amd/map.c
amd/nfs_subr.c

index c352a322b22ce7d819415a66421c19e2d0d4753a..86d0ab7a8d303dac50239f8677626d8b2ba2a1be 100644 (file)
@@ -1129,8 +1129,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
    */
   if (current_transp && !new_mp->am_transp) {
     dlog("Saving RPC transport for %s", new_mp->am_path);
-    new_mp->am_transp = (SVCXPRT *) xmalloc(sizeof(SVCXPRT));
-    *(new_mp->am_transp) = *current_transp;
+    new_mp->am_transp = get_nfs_xprt(current_transp);
   }
   if (error && new_mp->am_al && new_mp->am_al->al_mnt &&
       (new_mp->am_al->al_mnt->mf_ops == &amfs_error_ops))
index 0d404cfdbd6655e4e0ca8781f3a5e4f7b7afddb7..bcb215629d77c109952f30dd435bdd6e3a3a0293 100644 (file)
--- a/amd/map.c
+++ b/amd/map.c
@@ -471,7 +471,7 @@ free_map(am_node *mp)
   XFREE(mp->am_name);
   XFREE(mp->am_path);
   XFREE(mp->am_pref);
-  XFREE(mp->am_transp);
+  put_nfs_xprt(mp->am_transp);
 
   if (mp->am_al)
     free_loc(mp->am_al);
index 0a43b988e716ce92f149ec20ac826a613f58f44a..07d960d7d75ec73f2edf3a4dd55db5fbb9abf174 100644 (file)
@@ -291,7 +291,8 @@ nfs_quick_reply(am_node *mp, int error)
     /*
      * Free up transp.  It's only used for one reply.
      */
-    XFREE(mp->am_transp);
+    put_nfs_xprt(mp->am_transp);
+    mp->am_transp = NULL;
     dlog("Quick reply sent for %s", mp->am_al->al_mnt->mf_mount);
   }
 }