X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Frw.c;h=9b2ecdd78446e257ced06a56f3477b034fd6e9d0;hp=2979d17f9d21398bfba4c09f6b227ff81b0e653a;hb=6bce536725efd166d2772f13fe954f271f9c53b8;hpb=b9c155065d2ca4a6037a0ca4bfc788d6961fdc8e diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 2979d17..9b2ecdd 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -1569,6 +1569,20 @@ int ll_readpage(struct file *file, struct page *vmpage) RETURN(result); } + /** + * 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 (file->f_flags & O_DIRECT && + lcc && lcc->lcc_type == LCC_RW && + !io->ci_ignore_lockless) { + unlock_page(vmpage); + io->ci_ignore_lockless = 1; + io->ci_need_restart = 1; + RETURN(-ENOLCK); + } + LASSERT(io->ci_state == CIS_IO_GOING); page = cl_page_find(env, clob, vmpage->index, vmpage, CPT_CACHEABLE); if (!IS_ERR(page)) {