Ignore people who tell you that you don't need as much spray foam because it is better air sealing or whatnot. That just comes from lazy installers who don't like working with the material and want to prevent sticker shock. R-value is R-value. 4" will be twice as insulating as 2".
But to get to the heart of the matter, there's one and only one reason why you even need spray foam there instead of batt insulation: to create an air barrier to prevent any moisture-laden air that gets past the drywall from hitting the cold roof sheathing, condensing, and starting to rot the wood, which as you can imagine is very bad.
You don't need a full 6" of spray foam up there. You only need enough to fully encapsulate the underside of the roof sheathing to prevent interior air from hitting it. So 2" of spray foam would be fine, and then you could fill the remainder of the cavity with lower-cost open cell spray foam, or typical batt insulation, or blown-in cellulose, or anything really; it's all safe because you've created that crucial air barrier.
Alternatively, you could avoid this whole rigamarole by increasing the thickness of the foam insulation above the roof deck, thereby keeping it warmer and above the dew point, which would make any moist air that gets up there not condense in the first place. You'd want to increase it by at least 5". If you're in a predominately cold climate, don't use polyiso, which has worse performance in the cold--stick to XPS or EPS. In this case, you could stick whatever you wanted in those cavities. I would recommend blown-in dense-packed cellulose, because you wouldn't even need to take off the drywall.
If you want R-50 or 60 in your roof, you don't have a lot of great options without significant modifications. Entirely filling the bays with spray foam will only reach R-42, plus R5 or so from the foam above the sheathing. It requires tearing off and replacing the ceiling drywall and only gets you to R-47. Don't forget that thermal bridging of those 2x6s reduces the effective R-value. To go farther and correct some of these issues, you could additionally put more foam boards between the underside of the rafters and the new drywall, which could boost you up to R-57 with 2" foam boards. You'd only lose two inches of ceiling height.
Packing more foam above the roof deck will let you reach whatever R-value you want and fill the bays with whatever you want. It's the cheaper preferred approach, but requires removing the rubber roofing membrane and may undesirably increase the height of the roof above parapets or whatnot. If the roof is in bad shape and needs replacement soon anyway, that would be a perfect opportunity to substantially increase the foam thickness underneath the new roof.
This is the approach recommended by the Building Science Corporation:
So, what should we do with these flat roofs and cathedral ceilings that can’t be vented and insulated in the “typical” way? Simple, follow the building code. Add insulation on the top of the deck to elevate the roof deck temperature above the dew point of the interior air vapor mix (Figure 1) before dense packing or take the interior ceiling down and install an air impermeable insulation. Spray foam on the underside of the roof deck (Figure 2). The thermal resistance of the insulation needed to be added above the roof deck or in the form of spray foam on the underside of the roof deck is dependent on climate and the interior moisture load.