In Tolkien’s The Lord of the Rings there is a famous scene outside the dwarven mines of Moria, where invisible runes written on the door (and revealed by the wizard Gandalf) give our heroes the clue as to how to get the door to open, namely by saying the word ‘friend’.
Personally, I like Nanny Ogg’s way better.
The section dealing with dwarfs (and in fact, almost everything Terry writes about dwarfs) is a parody of Tolkien’s dwarves.
In particular, compare the witches’ musings on mine entries and invisible runes to Tolkien’s scenes outside Moria. Dwarf bread brings to mind Tolkien’s waybreads: cram and lembas. And as the witches leave the dwarfs, they have an encounter with a wretched creature mumbling something about his birthday…