
51 Cal.App.4th 1056 (1996)
LEONARD RYDER et al., Plaintiffs and Respondents,
v.
DONALD H. PETERSON et al., Defendants and Appellants.
Docket No. D022339.
Court of Appeals of California, Fourth District, Division One.
December 19, 1996.
*1057 COUNSEL
A. David Puzo for Defendants and Appellants.
Allison & Stavros, James N. Allison and Mark D. Stavros for Plaintiffs and Respondents.
OPINION
McINTYRE, J.
This case presents the issue of whether a party defendant who is voluntarily dismissed from an action prior to trial is entitled to recover attorney fees based on a contractual provision. We answer the question in the negative.

FACTUAL AND PROCEDURAL HISTORY
The facts in this matter are undisputed. Leonard and Susan Ryder entered into a written agreement for the purchase of the single-family residence with the sellers, Donald H. and Mary Peterson, in May of 1992. Escrow closed and the Ryders acquired the property in July 1992.
Paragraph 23 of the purchase agreement provided: "In any action, proceeding or arbitration arising out of this agreement, the prevailing party shall be entitled to reasonable attorney's fees and costs."
On November 23, 1993, the Ryders filed this action against the Petersons as well as the real estate agents and brokers involved in the transaction. The complaint set forth both contract and tort causes of action, all relating to claimed defects in the roof of the house. The Petersons answered and cross-complained against certain other parties. Discovery ensued for the next several months. On July 26, 1994, the Ryders filed a request for voluntary dismissal without prejudice of the complaint as to the Petersons only. There was no underlying settlement of the case with the Petersons. Subsequently, the Ryders settled with the remaining defendants. The Petersons requested that the trial court award them reasonable attorney fees pursuant to the *1058 written contract. The trial court denied the request based upon the decision of our Supreme Court in International Industries, Inc. v. Olen (1978) 21 Cal.3d 218 [145 Cal. Rptr. 691, 577 P.2d 1031].

DISCUSSION
(1) In International Industries, Inc. v. Olen, supra, 21 Cal.3d 218, an action was brought by a sublessor against its sublessee for damages for breach of a written lease agreement. The complaint included a claim for reasonable attorney fees based on a provision in the lease agreement allowing the lessor to recover costs and attorney fees incurred in enforcing its rights on the agreement. After several months, the sublessor filed a request for voluntary dismissal without prejudice. The sublessee moved for an order granting attorney fees based on the reciprocal provisions of Civil Code section 1717.[1] The court noted that Civil Code section 1717 intended to create a reciprocal right to attorney fees when the contract provided that right to one but not both of the parties.
The court in International Industries, Inc. v. Olen, supra, 21 Cal.3d 218, then considered the question of whether it should adopt a rule that permits a defendant to automatically recover attorney fees when a plaintiff voluntarily dismisses the matter before trial. Reasoning that it was faced with "a Hobson's choice of either (1) adopting an automatic right to attorney fees, thereby encouraging the maintenance of pointless litigation and violating the equitable principles which should govern attorney fee clauses, (2) providing for application of equitable considerations, requiring use of scarce judicial resources for trial of the merits of dismissed actions, or (3) continuing the former rule, denying attorney fees in spite of agreement" (id. at p. 225), the court concluded that "concern for the efficient and equitable administration of justice requires that the parties in pretrial dismissal cases be left to bear their own attorney fees, whether claim is asserted on the basis of the contract or [Civil Code] section 1717's reciprocal right" (ibid.). Subsequently in 1981, the Legislature added subdivision (b)(2) to Civil Code section 1717 specifically barring the award of fees after a voluntary pretrial dismissal.

CODE OF CIVIL PROCEDURE SECTION 1021
The Petersons assert that as prevailing parties, they are entitled to attorney fees based on cases interpreting Code of Civil Procedure section 1021. That section provides as follows: "Except as attorney's fees are specifically *1059 provided for by statute, the measure and mode of compensation of attorneys and counselors at law is left to the agreement, express or implied, of the parties; but parties to actions or proceedings are entitled to their costs, as hereinafter provided."
This statute has been interpreted in several cases to allow recovery of attorney fees pursuant to contractual provisions similar to the one at issue in this case where the defendant prevailed after trial. In Xuereb v. Marcus & Millichap, Inc. (1992) 3 Cal. App.4th 1338 [5 Cal. Rptr.2d 154], the plaintiff asserted both breach of contract and tort theories, but dismissed the contract claims before the case was submitted to the jury.
After a favorable decision, the defendants moved to recover attorney fees based upon a written provision for attorney fees to the prevailing party "[i]f this Agreement gives rise to a lawsuit or other legal proceeding...." (Xuereb v. Marcus & Millichap, Inc., supra, 3 Cal. App.4th at p. 1340.) The trial court denied the defendants' request, but the Court of Appeal reversed, holding that plaintiffs were entitled to attorney fees under Code of Civil Procedure section 1021 because that statute provided "the basic right to an award of attorney fees." (3 Cal. App.4th at p. 1341.)[2] The court held that the tort causes of action, as well as the contract theories, arose from the written agreement, and thus under Code of Civil Procedure section 1021 the allocation of attorney fees was subject to the agreement of the parties. The court noted there is nothing in the statute that limited its application to contract actions alone, and that the parties may validly agree that the prevailing party will be awarded attorney fees incurred in any litigation between themselves whether sounding in tort or in contract. The Xuereb holding was followed in two subsequent cases, Lerner v. Ward (1993) 13 Cal. App.4th 155 [16 Cal. Rptr.2d 486] and Palmer v. Shawback (1993) 17 Cal. App.4th 296 [21 Cal. Rptr.2d 575].
None of these cases involved the situation here where the action was voluntarily dismissed prior to trial. Nevertheless, the Petersons assert the Olen holding barring the recovery of attorney fees is not applicable in spite of the fact this matter involves a pretrial dismissal case, since their motion was made pursuant to Code of Civil Procedure section 1021 and not under Civil Code section 1717.


*1060 RECENT CASES
Since the trial court's decision in this matter, there have been several appellate decisions on this subject. In the first, Jue v. Patton (1995) 33 Cal. App.4th 456 [39 Cal. Rptr.2d 364], on facts identical to this case, Division Four of the First District affirmed the trial court's denial of attorney fees. As here, the sellers contended they were entitled to attorney fees based upon the Xuereb line of cases interpreting Code of Civil Procedure section 1021. The Jue court, noting that those cases did not involve any incidents of voluntary dismissal prior to trial, concluded that "[i]t is now well settled that in pretrial dismissal cases, the parties are left to bear their own attorney fees." (Jue v. Patton, supra, 33 Cal. App.4th at p. 460, citing International Industries, Inc. v. Olen, supra, 21 Cal.3d at pp. 224-225; see also Sweat v. Hollister (1995) 37 Cal. App.4th 603, 611-612, fn. 7 [43 Cal. Rptr.2d 399]; Kelley v. Bredelis (1996) 45 Cal. App.4th 1819, 1834 [53 Cal. Rptr.2d 536] (dis. opn. of McKinster, J.).)
Other cases construe Olen more narrowly. For example in Honey Baked Hams, Inc. v. Dickens (1995) 37 Cal. App.4th 421 [43 Cal. Rptr.2d 595], the Third District reasoned that while the language of the Olen decision is fairly broad, it must be considered in context, i.e., in light of the fact that the motion for attorney fees was based on Civil Code section 1717. The court further reasoned that the language of its particular contractual provision was broader because it provided that the "successful party" may obtain "a reasonable sum for attorneys' fees which shall be deemed to have accrued on the commencement of such action and shall be paid whether or not such action is prosecuted to judgment." (Honey Baked Hams, Inc. v. Dickens, supra, 37 Cal. App.4th at p. 424, italics omitted.) It concluded that as a matter of contractual interpretation, the defendant was entitled to attorney fees under this provision regardless of the pretrial dismissal by the plaintiff. It disagreed with the reasoning of the Jue court regarding the broad effect of the Supreme Court's holding in the Olen matter, stating that the question of a defendant's claim for contractual fees enforced independent of Civil Code section 1717 was "not before the Olen court...." (Honey Baked Hams, Inc. v. Dickens, supra, 37 Cal. App.4th at p. 428, fn. omitted; see also Kelley v. Bredelis, supra, 45 Cal. App.4th at pp. 1828-1829.)

CONCLUSION
It appears to us somewhat anomalous to allow a recovery of attorney fees after a voluntary pretrial dismissal under Code of Civil Procedure section 1021 when that specific result is barred under the provisions of Civil Code section 1717, subdivision (b)(2). It would appear that the Legislature, in *1061 enacting that section in 1981, was codifying the Olen result. In any event, the discussion of the subject by the Olen court involved outlining the alternatives available and the policy considerations mandating denial of fees following a voluntary dismissal; it thus involves more than a construction of Civil Code section 1717. Therefore, we conclude that Olen precludes the Petersons from recovering attorney fees under either Code of Civil Procedure section 1021 or Civil Code section 1717 where their request is based on a contractual provision.

DISPOSITION
The order is affirmed. Respondents to recover costs on appeal.
Kremer, P.J., and Huffman, J., concurred.
NOTES
[1]  At the time of the Olen decision, the statute did not include subdivision (b)(2), which specifically provides that when a voluntary dismissal occurs prior to trial, no attorney fees may be awarded.
[2]  The Xuereb court cited Brusso v. Running Springs Country Club, Inc. (1991) 228 Cal. App.3d 92 [278 Cal. Rptr. 758], for this proposition. That case involved the question of whether Corporations Code section 800, which creates the shareholders' derivative right of action, exclusively governs the award of attorney fees or whether section 1717 of the Civil Code was controlling. It makes the statement that Code of Civil Procedure section 1021 provides the basic right to an award of attorney fees without citation to any authority.
