X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Frw26.c;h=ab6bec998f03aaa03fcd18bb9c57fb45e83164c8;hp=6f2bb6c0ffb71635256f64640901d1d9e767a905;hb=6bce536725efd166d2772f13fe954f271f9c53b8;hpb=361e9eaef13c0f472ad45388d3e147dabc32b737 diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 6f2bb6c..ab6bec9 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -672,14 +672,25 @@ 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) { + if (file->f_flags & O_DIRECT) { /* 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); - } + if (io->ci_designated_mirror > 0) + GOTO(out, result = -EBUSY); + /** + * Direct read can fall back to buffered read, but DIO is done + * with lockless i/o, and buffered requires LDLM locking, so + * in this case we must restart without lockless. + */ + if (!io->ci_ignore_lockless) { + io->ci_ignore_lockless = 1; + io->ci_need_restart = 1; + GOTO(out, result = -ENOLCK); + } + } again: /* To avoid deadlock, try to lock page first. */ vmpage = grab_cache_page_nowait(mapping, index);