writeback: Update dirty flags in two steps