nfs4client.c (d21bd6898336a7892914d308d5e0868f0b863571) nfs4client.c (c156618e15101a9cc8c815108fec0300a0ec6637)
1/*
2 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
3 * Written by David Howells (dhowells@redhat.com)
4 */
5#include <linux/module.h>
6#include <linux/nfs_fs.h>
7#include <linux/nfs_mount.h>
8#include <linux/sunrpc/addr.h>

--- 390 unchanged lines hidden (view full) ---

399 goto error;
400 }
401 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
402
403 error = nfs4_init_client_minor_version(clp);
404 if (error < 0)
405 goto error;
406
1/*
2 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
3 * Written by David Howells (dhowells@redhat.com)
4 */
5#include <linux/module.h>
6#include <linux/nfs_fs.h>
7#include <linux/nfs_mount.h>
8#include <linux/sunrpc/addr.h>

--- 390 unchanged lines hidden (view full) ---

399 goto error;
400 }
401 __set_bit(NFS_CS_IDMAP, &clp->cl_res_state);
402
403 error = nfs4_init_client_minor_version(clp);
404 if (error < 0)
405 goto error;
406
407 if (!nfs4_has_session(clp))
408 nfs_mark_client_ready(clp, NFS_CS_READY);
409
410 error = nfs4_discover_server_trunking(clp, &old);
411 if (error < 0)
412 goto error;
413
407 error = nfs4_discover_server_trunking(clp, &old);
408 if (error < 0)
409 goto error;
410
414 if (clp != old)
411 if (clp != old) {
415 clp->cl_preserve_clid = true;
412 clp->cl_preserve_clid = true;
413 /*
414 * Mark the client as having failed initialization so other
415 * processes walking the nfs_client_list in nfs_match_client()
416 * won't try to use it.
417 */
418 nfs_mark_client_ready(clp, -EPERM);
419 }
416 nfs_put_client(clp);
417 clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags);
418 return old;
419
420error:
421 nfs_mark_client_ready(clp, error);
422 nfs_put_client(clp);
423 return ERR_PTR(error);

--- 110 unchanged lines hidden (view full) ---

534 .clientid = new->cl_clientid,
535 .confirm = new->cl_confirm,
536 };
537 int status = -NFS4ERR_STALE_CLIENTID;
538
539 spin_lock(&nn->nfs_client_lock);
540 list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
541
420 nfs_put_client(clp);
421 clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags);
422 return old;
423
424error:
425 nfs_mark_client_ready(clp, error);
426 nfs_put_client(clp);
427 return ERR_PTR(error);

--- 110 unchanged lines hidden (view full) ---

538 .clientid = new->cl_clientid,
539 .confirm = new->cl_confirm,
540 };
541 int status = -NFS4ERR_STALE_CLIENTID;
542
543 spin_lock(&nn->nfs_client_lock);
544 list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
545
546 if (pos == new)
547 goto found;
548
542 status = nfs4_match_client(pos, new, &prev, nn);
543 if (status < 0)
544 goto out_unlock;
545 if (status != 0)
546 continue;
547 /*
548 * We just sent a new SETCLIENTID, which should have
549 * caused the server to return a new cl_confirm. So if

--- 4 unchanged lines hidden (view full) ---

554 if ((new != pos) && nfs4_same_verifier(&pos->cl_confirm,
555 &new->cl_confirm))
556 continue;
557 /*
558 * But if the cl_confirm's are different, then the only
559 * way that a SETCLIENTID_CONFIRM to pos can succeed is
560 * if new and pos point to the same server:
561 */
549 status = nfs4_match_client(pos, new, &prev, nn);
550 if (status < 0)
551 goto out_unlock;
552 if (status != 0)
553 continue;
554 /*
555 * We just sent a new SETCLIENTID, which should have
556 * caused the server to return a new cl_confirm. So if

--- 4 unchanged lines hidden (view full) ---

561 if ((new != pos) && nfs4_same_verifier(&pos->cl_confirm,
562 &new->cl_confirm))
563 continue;
564 /*
565 * But if the cl_confirm's are different, then the only
566 * way that a SETCLIENTID_CONFIRM to pos can succeed is
567 * if new and pos point to the same server:
568 */
569found:
562 refcount_inc(&pos->cl_count);
563 spin_unlock(&nn->nfs_client_lock);
564
565 nfs_put_client(prev);
566 prev = pos;
567
568 status = nfs4_proc_setclientid_confirm(pos, &clid, cred);
569 switch (status) {
570 case -NFS4ERR_STALE_CLIENTID:
571 break;
572 case 0:
573 nfs4_swap_callback_idents(pos, new);
574 pos->cl_confirm = new->cl_confirm;
570 refcount_inc(&pos->cl_count);
571 spin_unlock(&nn->nfs_client_lock);
572
573 nfs_put_client(prev);
574 prev = pos;
575
576 status = nfs4_proc_setclientid_confirm(pos, &clid, cred);
577 switch (status) {
578 case -NFS4ERR_STALE_CLIENTID:
579 break;
580 case 0:
581 nfs4_swap_callback_idents(pos, new);
582 pos->cl_confirm = new->cl_confirm;
583 nfs_mark_client_ready(pos, NFS_CS_READY);
575
576 prev = NULL;
577 *result = pos;
578 goto out;
579 case -ERESTARTSYS:
580 case -ETIMEDOUT:
581 /* The callback path may have been inadvertently
582 * changed. Schedule recovery!

--- 649 unchanged lines hidden ---
584
585 prev = NULL;
586 *result = pos;
587 goto out;
588 case -ERESTARTSYS:
589 case -ETIMEDOUT:
590 /* The callback path may have been inadvertently
591 * changed. Schedule recovery!

--- 649 unchanged lines hidden ---