Whamcloud - gitweb
LU-9771 flr: resync support and test tool
[fs/lustre-release.git] / lustre / llite / rw26.c
index 1d44187..03530ce 100644 (file)
@@ -642,6 +642,14 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
        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);