<PAGE>

                                                                   Exhibit 10.38

                               THIRD AMENDMENT TO
          AMENDED AND RESTATED REVOLVING CREDIT AND SECURITY AGREEMENT

     This THIRD AMENDMENT TO AMENDED AND RESTATED REVOLVING CREDIT AND SECURITY
AGREEMENT (this "Amendment") is made this ___ day of July, 2001 by and between
AVANEX CORPORATION, a Delaware corporation ("Borrower") and COMERICA
BANK-CALIFORNIA, a California banking corporation ("Bank").

                                    RECITALS

     WHEREAS, Borrower and Bank have previously entered into that certain
Amended and Restated Revolving Credit Loan and Security Agreement dated
July 10, 2000; as amended by that certain First Amendment to Amended and
Restated Revolving Credit Loan and Security Agreement dated August 24, 2000; and
that certain Second Amendment to Amended and Restated Revolving Credit Loan and
Security Agreement dated January 2, 2001 (as amended thereafter, the "Loan
Agreement"). The Loan Agreement, together with all documents, instruments and
agreements executed in connection therewith are collectively referred to as the
"Loan Documents"; and

     WHEREAS, Borrower has requested, and Bank has agreed, to further amend the
Loan Agreement to (a) include a formula for advances when the principal balance
of the Obligations is in excess of Ten Million and 00/100 Dollars
($10,000,000.00); (b) extend the Termination Date; and (c) amend certain
financial covenants.

                                    AGREEMENT

     NOW, THEREFORE, in consideration of the mutual covenants and
conditions contained in this Amendment, the parties hereto agree as follows:

     1. Incorporation by Reference; Definitions. The foregoing Recitals and the
        ---------------------------------------
Loan Documents are incorporated herein by this reference as though set forth in
full herein. Any capitalized terms not defined herein shall have the meanings
given in the Loan Documents.

     2. Amendment to the Loan Agreement. The parties have agreed to the
        -------------------------------
amendments to the Loan Agreement set forth in this Section 2.

        2.1 Amendment to the Definition of "Borrowing Base". The definition of
            -----------------------------------------------
the term "Borrowing Base" is hereby deleted in its entirety and replaced with
the following:

        "Borrowing Base" shall mean the sum of eighty percent (80%) of
     Borrower's Eligible Accounts after deducting therefrom all payments,
     adjustments and credits applicable thereto."

        2.2 Amendment to Add Definition of "Eligible Account". The following
            -------------------------------------------------
definition of the term "Eligible Account" is hereby added to the Loan Agreement:

        "Eligible Account" means an account (but shall not include interest
     and service charges thereon) arising in the ordinary course of Borrower's
     business which meets each of the following requirements: (a) it is not
     owing more than ninety (90) days after the date of the original invoice
     evidencing such account; (b) it is not owing by an account debtor who has
     failed to pay twenty-five percent (25%) or more of the aggregate amount of
     its accounts owing to Borrower within ninety (90) days after the date of
     the respective invoices evidencing such accounts; (c) it arises from the
     sale, lease, license, assignment or other disposition of goods and such
     goods have been shipped or delivered to

                                       1


<PAGE>

     the account debtor under such account; or it arises from services rendered
     and such services have been performed; (d) it is evidenced by an invoice,
     dated not later than the date of shipment or performance, rendered to such
     account debtor or some other evidence of billing acceptable to Bank; (e) it
     is not evidenced by any note, trade acceptance, draft or other negotiable
     instrument or by any chattel paper, unless such note, chattel paper or
     other document or instrument previously has been endorsed and delivered by
     Borrower (or the relevant Subsidiary) to Bank; (f) it is a valid, legally
     enforceable obligation of the account debtor thereunder, and is not subject
     to any offset, counterclaim or other defense on the part of such account
     debtor or to any claim on the part of such account debtor denying liability
     thereunder in whole or in part; (g) it is not subject to any sale of
     accounts, any rights of offset, assignment, lien or security interest
     whatsoever other than to Bank; (h) it is not owing by a Subsidiary or
     Affiliate of Borrower, nor by an account debtor which (i) does not maintain
     its chief executive office in the United States of America, (ii) is not
     organized under the laws of the United States of America, or any state
     thereof, or (iii) is the government of any foreign country or sovereign
     state, or of any state, province, municipality or other instrumentality
     thereof; (i) it is not an account owing by the United States of America or
     any state or political subdivision thereof, or by any department, agency,
     public body corporate or other instrumentality of any of the foregoing,
     unless all necessary steps are taken to comply with the Federal Assignment
     of Claims Act of 1940, as amended, or with any comparable state law, if
     applicable, and all other necessary steps are taken to perfect Bank's
     security interest in such account; (j) it is not owing by an account debtor
     for which Borrower or any of its Subsidiaries has received a notice of (i)
     the death of the account debtor or any partner of the account debtor, (ii)
     the dissolution, liquidation, termination of existence, insolvency or
     business failure of the account debtor, (iii) the appointment of a receiver
     for any part of the property of the account debtor, or (iv) an assignment
     for the benefit of creditors, the filing of a petition in bankruptcy, or
     the commencement of any proceeding under any bankruptcy or insolvency laws
     by or against the account debtor; (k) it is not an account billed in
     advance, payable on delivery, for consigned goods, for guaranteed sales,
     for unbilled sales, for progress billings, payable at a future date in
     accordance with its terms, subject to a retainage or holdback by the
     account debtor or insured by a surety company; (l) it is not owing by any
     account debtor whose obligations Bank, acting in its sole discretion, shall
     have notified Borrower are not deemed to constitute Eligible Accounts; (m)
     that portion of accounts owed by any single account debtor, including
     Subsidiaries and Affiliates, that do not exceed twenty percent (20%) of all
     Eligible Accounts; except as approved by Bank in writing; and, (n) accounts
     the collection of which Bank reasonably determines to be doubtful. An
     account which is at any time an Eligible Account, but which subsequently
     fails to meet any of the foregoing requirements, shall forthwith cease to
     be an Eligible Account.

        2.3 Amendment to Definition of "Termination Date". The definition of
            ---------------------------------------------
"Termination Date" is hereby amended by deleting the term "April 1, 2001" and
replacing it with the term "July 10, 2002."

        2.4 Amendment to Section 2.1 of the Loan Agreement. Section 2.1 of the
            ----------------------------------------------
Loan Agreement is hereby amended by deleting it in its entirety and replacing it
with the following:

        "2.1 Revolving Credit. Subject to and upon the terms and conditions of
             ----------------
     this Agreement, Bank agrees to make Advances to Borrower (pursuant to
     Section 2.1 hereof) and issue Letters of Credit (pursuant to Section


                                       2


<PAGE>

     2.2 hereof) under a revolving line of credit (the "Revolving Credit") from
     time to time in amounts requested by Borrower up to an aggregate
     outstanding principal amount equal to the lesser of: (a) the Committed Line
     less the face amount of all issued and outstanding Letters of Credit
     (including drawn but unreimbursed letters of credit); or (b) the Borrowing
     Base less the face amount of all issued and outstanding Letters of Credit
     (including drawn but unreimbursed letters of credit); provided, however,
     that Borrower may request, and Bank agrees to make, Advances to Borrower up
     to Ten Million and 00/100 Dollars ($10,000,000.00) regardless of the
     Borrowing Base. Subject to the terms and conditions of this Agreement,
     Borrower may borrow and reborrow under this Section 2.1."

         2.5   Amendment to Section 8 of the Loan Agreement. Section 8 of the
               --------------------------------------------
Loan Agreement is hereby amended by adding the following new Section 8.4:

         "8.4  Quarterly Loss. Borrower shall not incur, as of the last day of
               --------------
     each fiscal quarter, a loss in excess of Five Million and 00/100 Dollars
     ($5,000,000.00), excluding all non-cash and non-recurring charges."

         2.6   Amendment to Section 9.4 of the Loan Agreement. Section 9.4 of
               ----------------------------------------------
the Loan Agreement is hereby amended by deleting the term "One Hundred Million
and 00/100 Dollars ($100,000,000.00)" and replacing it with the term "Fifty
Million and 00/100 Dollars ($50,000,000.00)".

     3.  Relationship to the Loan Documents. All terms and conditions of the
         ----------------------------------
Loan Documents shall be and remain in full force and effect. Any reference to
any of the Loan Documents from and after the Effective Date shall mean the Loan
Documents as amended and modified by this Amendment. In the event of any
inconsistency between the provisions of this Amendment and the Loan Documents,
the provisions of this Amendment shall control.

     4.  Ratification of Obligations. Borrower ratifies and reaffirms the
         ---------------------------
Obligations, without setoff, defense, or counterclaim. Borrower agrees fully and
faithfully to pay, perform and discharge, as and when payment, performance and
discharge are due, all of the Obligations under the Loan Agreement, as amended
hereby.

     5.  Conflicts. If a conflict exists between the provisions of any of the
         ---------
Loan Documents and the provisions of this Amendment, the provisions of this
Amendment shall control.

     6.  Entire Agreement. This Amendment and the Loan Documents constitute the
         ----------------
entire agreement between the parties with respect to the subject matter hereof.
This Amendment supersedes all previous negotiations, discussions and agreements
between the parties, with respect to the subject matter hereof, and no parol
evidence of any prior or other agreement shall be permitted to contradict or
vary the terms hereof.

     7.  Further Documents. The parties hereto agree to execute and acknowledge
         -----------------
further documents, and to do such other acts as may be reasonably necessary to
carry out the terms, provisions and intent of this Amendment.

     8.  Governing Law. This Amendment and any documents executed in connection
         -------------
herewith shall be governed by and construed in accordance with the laws of the
State of California.

     9.  Successors and Assigns. This Amendment and any documents executed in
         ----------------------
connection herewith shall be binding on and inure to the benefit of the
successors and assigns of the parties hereto.

     10. Counterparts This Amendment may be signed in any number of
         ------------
counterparts, each of which shall be an original, with the same effect as if all
signatures were upon the same instrument. Delivery of an executed counterpart of
the signature page to this Amendment by telefacsimile shall be effective as
delivery of a

                                       3

<PAGE>

manually executed counterpart of this Amendment, and any party delivering such
an executed counterpart of the signature page to this Amendment by telefacsimile
to any other party shall thereafter also promptly deliver a manually executed
counterpart of this Amendment to such other party, provided that the failure to
deliver such manually executed counterpart shall not affect the validity,
enforceability, or binding effect of this Amendment.

     IN WITNESS WHEREOF, the parties hereto have executed this Third Amendment
to Amended and Restated Revolving Credit and Security Agreement as of the day
and year first written above.

AVANEX CORPORATION



------------------------------------------------
By:      Paul Engle
Its:     President and Chief Executive Officer



------------------------------------------------
By:      Jessy Chao
Title:   Chief Financial Officer




COMERICA BANK - CALIFORNIA



------------------------------------------------
By:      Arne F. Olson
Title:   Vice President

                                       4