Whamcloud - gitweb
LU-2723 clio: a client hangs on osc_extent_wait in dio
authorVitaly Fertman <vitaly_fertman@xyratex.com>
Thu, 31 Jan 2013 12:36:19 +0000 (16:36 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 4 Feb 2013 19:23:13 +0000 (14:23 -0500)
If dio overlaps with mapped region, first overlapped pages are sent
by generic_file_direct_write->filemap_write_and_wait_range->writepages
After that the dio pages are sent by write_begin/write_end, writepages
However, write_end->osc_page_cache_add does not release extent because
the IO is not considered as synchronous. as the result, the following
writepages->osc_cache_writeback_range() does not send pages as the
extent is still ACTIVE and osc_cache_wait_range() hangs forever.

The patch make directIO to be considered as sync by lustre so that
extent was released at write_end.

Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Xyratex-bug-id: MRP-839
Change-Id: I0c0e1599ee180f467826e4b6715c3cbfd0c6eb5c
Reviewed-on: http://review.whamcloud.com/5224
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c

index 6e5aa43..c2d75fc 100644 (file)
@@ -836,7 +836,9 @@ void ll_io_init(struct cl_io *io, const struct file *file, int write)
         io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
        if (write) {
                io->u.ci_wr.wr_append = !!(file->f_flags & O_APPEND);
-               io->u.ci_wr.wr_sync = file->f_flags & O_SYNC || IS_SYNC(inode);
+               io->u.ci_wr.wr_sync = file->f_flags & O_SYNC ||
+                                     file->f_flags & O_DIRECT ||
+                                     IS_SYNC(inode);
        }
         io->ci_obj     = ll_i2info(inode)->lli_clob;
         io->ci_lockreq = CILR_MAYBE;