Merge pull request #213 from earlchew/issues-212
Allow autoreconnect to be disabledlibnfs-4.0.0-vitalif
commit
367ef3b189
|
@ -233,6 +233,7 @@ EXTERN void nfs_set_pagecache_ttl(struct nfs_context *nfs, uint32_t v);
|
||||||
EXTERN void nfs_set_readahead(struct nfs_context *nfs, uint32_t v);
|
EXTERN void nfs_set_readahead(struct nfs_context *nfs, uint32_t v);
|
||||||
EXTERN void nfs_set_debug(struct nfs_context *nfs, int level);
|
EXTERN void nfs_set_debug(struct nfs_context *nfs, int level);
|
||||||
EXTERN void nfs_set_dircache(struct nfs_context *nfs, int enabled);
|
EXTERN void nfs_set_dircache(struct nfs_context *nfs, int enabled);
|
||||||
|
EXTERN void nfs_set_autoreconnect(struct nfs_context *nfs, int enabled);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invalidate the pagecache
|
* Invalidate the pagecache
|
||||||
|
|
|
@ -72,6 +72,7 @@ nfs_rmdir
|
||||||
nfs_rmdir_async
|
nfs_rmdir_async
|
||||||
nfs_service
|
nfs_service
|
||||||
nfs_set_auth
|
nfs_set_auth
|
||||||
|
nfs_set_autoreconnect
|
||||||
nfs_set_debug
|
nfs_set_debug
|
||||||
nfs_set_dircache
|
nfs_set_dircache
|
||||||
nfs_set_gid
|
nfs_set_gid
|
||||||
|
|
11
lib/libnfs.c
11
lib/libnfs.c
|
@ -148,6 +148,7 @@ struct nfs_context {
|
||||||
uint64_t writemax;
|
uint64_t writemax;
|
||||||
char *cwd;
|
char *cwd;
|
||||||
int dircache_enabled;
|
int dircache_enabled;
|
||||||
|
int auto_reconnect_enabled;
|
||||||
struct nfsdir *dircache;
|
struct nfsdir *dircache;
|
||||||
uint16_t mask;
|
uint16_t mask;
|
||||||
|
|
||||||
|
@ -360,6 +361,8 @@ static int nfs_set_context_args(struct nfs_context *nfs, const char *arg, const
|
||||||
nfs->auto_traverse_mounts = atoi(val);
|
nfs->auto_traverse_mounts = atoi(val);
|
||||||
} else if (!strcmp(arg, "dircache")) {
|
} else if (!strcmp(arg, "dircache")) {
|
||||||
nfs_set_dircache(nfs, atoi(val));
|
nfs_set_dircache(nfs, atoi(val));
|
||||||
|
} else if (!strcmp(arg, "autoreconnect")) {
|
||||||
|
nfs_set_autoreconnect(nfs, atoi(val));
|
||||||
#ifdef HAVE_SO_BINDTODEVICE
|
#ifdef HAVE_SO_BINDTODEVICE
|
||||||
} else if (!strcmp(arg, "if")) {
|
} else if (!strcmp(arg, "if")) {
|
||||||
nfs_set_interface(nfs, val);
|
nfs_set_interface(nfs, val);
|
||||||
|
@ -529,6 +532,7 @@ struct nfs_context *nfs_init_context(void)
|
||||||
nfs->mask = 022;
|
nfs->mask = 022;
|
||||||
nfs->auto_traverse_mounts = 1;
|
nfs->auto_traverse_mounts = 1;
|
||||||
nfs->dircache_enabled = 1;
|
nfs->dircache_enabled = 1;
|
||||||
|
nfs->auto_reconnect_enabled = 1;
|
||||||
return nfs;
|
return nfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1026,8 @@ static void nfs_mount_9_cb(struct rpc_context *rpc, int status, void *command_da
|
||||||
/* NFS TCP connections should be autoreconnected after sessions have
|
/* NFS TCP connections should be autoreconnected after sessions have
|
||||||
* been torn down (due to inactivity or error)
|
* been torn down (due to inactivity or error)
|
||||||
*/
|
*/
|
||||||
rpc_set_autoreconnect(rpc);
|
if (nfs->auto_reconnect_enabled)
|
||||||
|
rpc_set_autoreconnect(rpc);
|
||||||
|
|
||||||
args.fsroot = nfs->rootfh;
|
args.fsroot = nfs->rootfh;
|
||||||
if (rpc_nfs3_fsinfo_async(rpc, nfs_mount_10_cb, &args, data) != 0) {
|
if (rpc_nfs3_fsinfo_async(rpc, nfs_mount_10_cb, &args, data) != 0) {
|
||||||
|
@ -5599,6 +5604,10 @@ void nfs_set_dircache(struct nfs_context *nfs, int enabled) {
|
||||||
nfs->dircache_enabled = enabled;
|
nfs->dircache_enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nfs_set_autoreconnect(struct nfs_context *nfs, int enabled) {
|
||||||
|
nfs->auto_reconnect_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void nfs_set_error(struct nfs_context *nfs, char *error_string, ...)
|
void nfs_set_error(struct nfs_context *nfs, char *error_string, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
Loading…
Reference in New Issue