A method and system mirror flexible volumes in a circular or
bi-directional configuration, without creating a deadlock. A source filer
maintains a number of log files on a destination filer, where the number
of log files is greater than or equal to the number of cache flush
operations the primary filer performs between cache flush operations on
the destination filer. The source filer can create the log files in
advance. Alternatively or in addition, the source filer can create the
log files as needed, i.e., the source filer can create a log file when
the source filer flushes its cache. Once the destination filer flushes
its cache, the log files created prior to the destination filer cache
flush can be deallocated or reused.