cifs: move update of flags into a separate function