diff options
-rw-r--r-- | fs/nfsd/nfs4state.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index f100eeab5458..884115198116 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -834,7 +834,7 @@ int | |||
834 | nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm) | 834 | nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm) |
835 | { | 835 | { |
836 | u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; | 836 | u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; |
837 | struct nfs4_client *clp, *conf = NULL, *unconf = NULL; | 837 | struct nfs4_client *conf, *unconf; |
838 | nfs4_verifier confirm = setclientid_confirm->sc_confirm; | 838 | nfs4_verifier confirm = setclientid_confirm->sc_confirm; |
839 | clientid_t * clid = &setclientid_confirm->sc_clientid; | 839 | clientid_t * clid = &setclientid_confirm->sc_clientid; |
840 | int status; | 840 | int status; |
@@ -847,28 +847,16 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi | |||
847 | */ | 847 | */ |
848 | 848 | ||
849 | nfs4_lock_state(); | 849 | nfs4_lock_state(); |
850 | clp = find_confirmed_client(clid); | 850 | |
851 | if (clp) { | 851 | conf = find_confirmed_client(clid); |
852 | status = nfserr_clid_inuse; | 852 | unconf = find_unconfirmed_client(clid); |
853 | if (clp->cl_addr != ip_addr) { | 853 | |
854 | printk("NFSD: setclientid: string in use by client" | 854 | status = nfserr_clid_inuse; |
855 | "(clientid %08x/%08x)\n", | 855 | if (conf && conf->cl_addr != ip_addr) |
856 | clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id); | 856 | goto out; |
857 | goto out; | 857 | if (unconf && unconf->cl_addr != ip_addr) |
858 | } | 858 | goto out; |
859 | conf = clp; | 859 | |
860 | } | ||
861 | clp = find_unconfirmed_client(clid); | ||
862 | if (clp) { | ||
863 | status = nfserr_clid_inuse; | ||
864 | if (clp->cl_addr != ip_addr) { | ||
865 | printk("NFSD: setclientid: string in use by client" | ||
866 | "(clientid %08x/%08x)\n", | ||
867 | clp->cl_clientid.cl_boot, clp->cl_clientid.cl_id); | ||
868 | goto out; | ||
869 | } | ||
870 | unconf = clp; | ||
871 | } | ||
872 | if ((conf && unconf) && | 860 | if ((conf && unconf) && |
873 | (cmp_verf(&unconf->cl_confirm, &confirm)) && | 861 | (cmp_verf(&unconf->cl_confirm, &confirm)) && |
874 | (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) && | 862 | (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) && |
@@ -884,9 +872,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi | |||
884 | else { | 872 | else { |
885 | /* XXX: We just turn off callbacks until we can handle | 873 | /* XXX: We just turn off callbacks until we can handle |
886 | * change request correctly. */ | 874 | * change request correctly. */ |
887 | clp = conf; | 875 | conf->cl_callback.cb_parsed = 0; |
888 | clp->cl_callback.cb_parsed = 0; | 876 | gen_confirm(conf); |
889 | gen_confirm(clp); | ||
890 | expire_client(unconf); | 877 | expire_client(unconf); |
891 | status = nfs_ok; | 878 | status = nfs_ok; |
892 | 879 | ||
@@ -901,12 +888,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi | |||
901 | * unconf->cl_name or unconf->cl_verifier don't match the | 888 | * unconf->cl_name or unconf->cl_verifier don't match the |
902 | * conf record. | 889 | * conf record. |
903 | */ | 890 | */ |
904 | if (!cmp_creds(&conf->cl_cred,&rqstp->rq_cred)) { | 891 | if (!cmp_creds(&conf->cl_cred,&rqstp->rq_cred)) |
905 | status = nfserr_clid_inuse; | 892 | status = nfserr_clid_inuse; |
906 | } else { | 893 | else |
907 | clp = conf; | ||
908 | status = nfs_ok; | 894 | status = nfs_ok; |
909 | } | ||
910 | } else if (!conf && unconf | 895 | } else if (!conf && unconf |
911 | && cmp_verf(&unconf->cl_confirm, &confirm)) { | 896 | && cmp_verf(&unconf->cl_confirm, &confirm)) { |
912 | /* CASE 3: | 897 | /* CASE 3: |
@@ -924,8 +909,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi | |||
924 | if (conf) { | 909 | if (conf) { |
925 | expire_client(conf); | 910 | expire_client(conf); |
926 | } | 911 | } |
927 | clp = unconf; | ||
928 | move_to_confirmed(unconf); | 912 | move_to_confirmed(unconf); |
913 | conf = unconf; | ||
929 | status = nfs_ok; | 914 | status = nfs_ok; |
930 | } | 915 | } |
931 | } else if ((!conf || (conf && !cmp_verf(&conf->cl_confirm, &confirm))) | 916 | } else if ((!conf || (conf && !cmp_verf(&conf->cl_confirm, &confirm))) |
@@ -944,7 +929,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi | |||
944 | } | 929 | } |
945 | out: | 930 | out: |
946 | if (!status) | 931 | if (!status) |
947 | nfsd4_probe_callback(clp); | 932 | nfsd4_probe_callback(conf); |
948 | nfs4_unlock_state(); | 933 | nfs4_unlock_state(); |
949 | return status; | 934 | return status; |
950 | } | 935 | } |