New version 1.1
[deb_libnfs.git] / lib / libnfs.c
index c1b4962caffa1efb3e7fdf8b68d3502f7c87b493..a966b02f272fd62fcec84b4318e7937b2b0fe34a 100644 (file)
@@ -111,7 +111,7 @@ struct nfs_mcb_data {
 static int nfs_lookup_path_async_internal(struct nfs_context *nfs, struct nfs_cb_data *data, struct nfs_fh3 *fh);
 
 
-void nfs_set_auth(struct nfs_context *nfs, struct AUTH *auth)
+void nfs_set_auth(struct nfs_context *nfs, AUTH *auth)
 {
        rpc_set_auth(nfs->rpc, auth);
 }
@@ -292,6 +292,9 @@ static void nfs_mount_7_cb(struct rpc_context *rpc, int status, void *command_da
        struct nfs_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
 
+       /* Dont want any more callbacks even if the socket is closed */
+       rpc->connect_cb = NULL;
+
        if (status == RPC_STATUS_ERROR) {
                data->cb(-EFAULT, nfs, command_data, data->private_data);
                free_nfs_cb_data(data);
@@ -352,6 +355,8 @@ static void nfs_mount_6_cb(struct rpc_context *rpc, int status, void *command_da
                free_nfs_cb_data(data);
                return;
        }
+       /* NFS TCP connections we want to autoreconnect after sessions are torn down (due to inactivity or error) */
+       rpc_set_autoreconnect(rpc);
 }
 
 
@@ -383,6 +388,9 @@ static void nfs_mount_4_cb(struct rpc_context *rpc, int status, void *command_da
        struct nfs_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
 
+       /* Dont want any more callbacks even if the socket is closed */
+       rpc->connect_cb = NULL;
+
        if (status == RPC_STATUS_ERROR) {
                data->cb(-EFAULT, nfs, command_data, data->private_data);
                free_nfs_cb_data(data);
@@ -463,6 +471,9 @@ static void nfs_mount_1_cb(struct rpc_context *rpc, int status, void *command_da
        struct nfs_cb_data *data = private_data;
        struct nfs_context *nfs = data->nfs;
 
+       /* Dont want any more callbacks even if the socket is closed */
+       rpc->connect_cb = NULL;
+
        if (status == RPC_STATUS_ERROR) {
                data->cb(-EFAULT, nfs, command_data, data->private_data);
                free_nfs_cb_data(data);
@@ -499,12 +510,10 @@ int nfs_mount_async(struct nfs_context *nfs, const char *server, const char *exp
        new_export = strdup(export);
        if (nfs->server != NULL) {
                free(nfs->server);
-               nfs->server = NULL;
        }
        nfs->server        = new_server;
        if (nfs->export != NULL) {
                free(nfs->export);
-               nfs->export = NULL;
        }
        nfs->export        = new_export;
        data->nfs          = nfs;
@@ -3260,6 +3269,9 @@ static void mount_export_4_cb(struct rpc_context *rpc, int status, void *command
 {
        struct mount_cb_data *data = private_data;
 
+       /* Dont want any more callbacks even if the socket is closed */
+       rpc->connect_cb = NULL;
+
        if (status == RPC_STATUS_ERROR) {       
                data->cb(rpc, -EFAULT, command_data, data->private_data);
                free_mount_cb_data(data);
@@ -3336,6 +3348,9 @@ static void mount_export_1_cb(struct rpc_context *rpc, int status, void *command
 {
        struct mount_cb_data *data = private_data;
 
+       /* Dont want any more callbacks even if the socket is closed */
+       rpc->connect_cb = NULL;
+
        if (status == RPC_STATUS_ERROR) {
                data->cb(rpc, -EFAULT, command_data, data->private_data);
                free_mount_cb_data(data);