--- --- --- diff -puN fs/nfs/client.c~nfs-try-each-flavor fs/nfs/client.c --- linux-2.6.18-rc5/fs/nfs/client.c~nfs-try-each-flavor 2006-10-18 23:24:23.000000000 -0400 +++ linux-2.6.18-rc5-andros/fs/nfs/client.c 2006-10-18 23:24:23.000000000 -0400 @@ -1133,6 +1133,21 @@ out_err: return PTR_ERR(auth); } +int nfs4_clnt_try_each_flavor(struct rpc_clnt *clnt, struct nfs4_secinfo_res *res, struct rpc_cred **cred) +{ + int status = -EPERM, i; + rpc_authflavor_t cur_flavor = clnt->cl_auth->au_flavor; + + for (i = 0; i < res->nflavors; i++){ + if (res->flavors[i] == cur_flavor) + continue; + status = nfs4_clnt_switch_flavor(clnt, res->flavors[i], cred); + if (!status) /* success */ + break; + } + return status; +} + #endif /* CONFIG_NFS_V4 */ /* diff -puN fs/nfs/internal.h~nfs-try-each-flavor fs/nfs/internal.h --- linux-2.6.18-rc5/fs/nfs/internal.h~nfs-try-each-flavor 2006-10-18 23:24:23.000000000 -0400 +++ linux-2.6.18-rc5-andros/fs/nfs/internal.h 2006-10-18 23:24:23.000000000 -0400 @@ -50,6 +50,9 @@ extern struct nfs_server *nfs_clone_serv extern int nfs4_clnt_switch_flavor(struct rpc_clnt *, rpc_authflavor_t flavor, struct rpc_cred **); +extern int nfs4_clnt_try_each_flavor(struct rpc_clnt *, + struct nfs4_secinfo_res *, + struct rpc_cred **cred); #ifdef CONFIG_PROC_FS extern int __init nfs_fs_proc_init(void); _