env = lcc->lcc_env;
io = lcc->lcc_io;
+ if (file->f_flags & O_DIRECT && io->ci_designated_mirror > 0) {
+ /* direct IO failed because it couldn't clean up cached pages,
+ * this causes a problem for mirror write because the cached
+ * page may belong to another mirror, which will result in
+ * problem submitting the I/O. */
+ GOTO(out, result = -EBUSY);
+ }
+
/* To avoid deadlock, try to lock page first. */
vmpage = grab_cache_page_nowait(mapping, index);