~ubuntu-branches/ubuntu/precise/openafs/precise-proposed

« back to all changes in this revision

Viewing changes to src/viced/host.c

  • Committer: Package Import Robot
  • Author(s): Russ Allbery
  • Date: 2012-03-28 17:25:05 UTC
  • mfrom: (28.2.13 sid)
  • Revision ID: package-import@ubuntu.com-20120328172505-y9iycrlfhtfsn7mv
Tags: 1.6.1-1
* New upstream release.
  - Do not ignore all InlineBulkStatus errors in file server.
  - Support for Linux 3.3 and 3.4.
  - Fix incorrect kernel error handling in afs_notify_change.
  - Fix locking around RXS_PreparePacket.

Show diffs side-by-side

added added

removed removed

Lines of Context:
698
698
    if (!host)
699
699
        return NULL;
700
700
 
 
701
    h_Hold_r(host);
 
702
    /* acquire the host lock withot dropping H_LOCK. we can do this here
 
703
     * because we know we will not block; we just created this host and
 
704
     * nobody else knows about it. */
 
705
    ObtainWriteLock(&host->lock);
 
706
 
701
707
    host->host = rxr_HostOf(r_con);
702
708
    host->port = rxr_PortOf(r_con);
703
709
 
729
735
    h_gethostcps(host);         /* do this under host hold/lock */
730
736
#endif
731
737
    host->FirstClient = NULL;
732
 
    h_Hold_r(host);
733
 
    h_Lock_r(host);
734
738
    h_InsertList_r(host);       /* update global host List */
735
739
#if FS_STATS_DETAILED
736
740
    /*
845
849
{
846
850
    struct client **cp, *client;
847
851
    int code;
 
852
    int wasdeleted = 0;
 
853
 
 
854
    if ((host->hostFlags & HOSTDELETED)) {
 
855
        wasdeleted = 1;
 
856
    }
848
857
 
849
858
    /* make sure host doesn't go away over h_NBLock_r */
850
859
    h_Hold_r(host);
857
866
    /* if somebody still has this host locked */
858
867
    if (code != 0) {
859
868
        char hoststr[16];
860
 
        ViceLog(0,
861
 
                ("Warning:  h_TossStuff_r failed; Host %" AFS_PTR_FMT " (%s:%d) was locked.\n",
862
 
                 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
 
869
        if (wasdeleted) {
 
870
            /* someone locked the host while HOSTDELETED was set; that is bad */
 
871
            ViceLog(0, ("Warning:  h_TossStuff_r failed; Host %" AFS_PTR_FMT
 
872
                        " (%s:%d flags 0x%x) was locked.\n",
 
873
                        host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
 
874
                        (unsigned)host->hostFlags));
 
875
        }
863
876
        return;
864
877
    } else {
865
878
        h_Unlock_r(host);
870
883
     * reacquire H_LOCK */
871
884
    if (host->refCount > 0) {
872
885
        char hoststr[16];
873
 
        ViceLog(0,
874
 
                ("Warning:  h_TossStuff_r failed; Host %" AFS_PTR_FMT " (%s:%d) was held.\n",
875
 
                 host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port)));
 
886
        if (wasdeleted) {
 
887
            /* someone grabbed a ref while HOSTDELETED was set; that is bad */
 
888
            ViceLog(0, ("Warning:  h_TossStuff_r failed; Host %" AFS_PTR_FMT
 
889
                        " (%s:%d flags 0x%x) was held.\n",
 
890
                        host, afs_inet_ntoa_r(host->host, hoststr), ntohs(host->port),
 
891
                        (unsigned)host->hostFlags));
 
892
        }
876
893
        return;
877
894
    }
878
895
 
2054
2071
                if (oldHost) {
2055
2072
                    int probefail = 0;
2056
2073
 
 
2074
                    /* This is a new address for an existing host. Update
 
2075
                     * the list of interfaces for the existing host and
 
2076
                     * delete the host structure we just allocated. */
 
2077
 
 
2078
                    /* mark the duplicate host as deleted before we do
 
2079
                     * anything. The probing code below may try to change
 
2080
                     * "oldHost" to the same IP address as "host" currently
 
2081
                     * has, and we do not want a pseudo-"collision" to be
 
2082
                     * noticed. */
 
2083
                    host->hostFlags |= HOSTDELETED;
 
2084
 
2057
2085
                    oldHost->hostFlags |= HWHO_INPROGRESS;
2058
2086
 
2059
2087
                    if (oldHost->interface) {
2080
2108
                                         oldHost,
2081
2109
                                         afs_inet_ntoa_r(oldHost->host, hoststr),
2082
2110
                                         ntohs(oldHost->port),code2));
2083
 
                            MultiProbeAlternateAddress_r(oldHost);
2084
 
                            probefail = 1;
 
2111
 
 
2112
                            if (MultiProbeAlternateAddress_r(oldHost)) {
 
2113
                                /* If MultiProbeAlternateAddress_r succeeded,
 
2114
                                 * it updated oldHost->host and oldHost->port
 
2115
                                 * to an address that responded successfully to
 
2116
                                 * a ProbeUuid, so it is as if the ProbeUuid
 
2117
                                 * call above returned success. So, only set
 
2118
                                 * 'probefail' if MultiProbeAlternateAddress_r
 
2119
                                 * fails. */
 
2120
                                probefail = 1;
 
2121
                            }
2085
2122
                        }
2086
2123
                    } else {
2087
2124
                        probefail = 1;
2088
2125
                    }
2089
2126
 
2090
 
                    /* This is a new address for an existing host. Update
2091
 
                     * the list of interfaces for the existing host and
2092
 
                     * delete the host structure we just allocated. */
2093
 
 
2094
 
                    /* prevent warnings while manipulating interface lists */
2095
 
                    host->hostFlags |= HOSTDELETED;
2096
 
 
2097
2127
                    if (oldHost->host != haddr || oldHost->port != hport) {
2098
2128
                        struct rx_connection *rxconn;
2099
2129
 
2137
2167
                                }
2138
2168
                            }
2139
2169
                        }
2140
 
                        h_AddHostToAddrHashTable_r(haddr, hport, oldHost);
2141
2170
                        oldHost->host = haddr;
2142
2171
                        oldHost->port = hport;
2143
2172
                        rxconn = oldHost->callback_rxcon;