Whamcloud - gitweb
LU-2367 osc: unplug IO queue for writeback anyway
authorJinshan Xiong <jinshan.xiong@intel.com>
Thu, 22 Nov 2012 22:31:36 +0000 (14:31 -0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 12 Jan 2013 04:13:25 +0000 (23:13 -0500)
osc_io_unplug_async() in osc_extent_release() may not unplug IO
queue due to a race in ptlrpc_queue_work(). As a fix, we should
unplug it when the page is being flushed or fsync calls.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ied1d6ad12b79a28229cdae83a9db9ad9b3189462
Reviewed-on: http://review.whamcloud.com/4659
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Prakash Surya <surya1@llnl.gov>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osc/osc_cache.c

index 469de7f..367d321 100644 (file)
@@ -2444,10 +2444,11 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io,
                ext->oe_memalloc = 1;
 
        ext->oe_urgent = 1;
-       if (ext->oe_state == OES_CACHE && cfs_list_empty(&ext->oe_link)) {
+       if (ext->oe_state == OES_CACHE) {
                OSC_EXTENT_DUMP(D_CACHE, ext,
                                "flush page %p make it urgent.\n", oap);
-               cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts);
+               if (cfs_list_empty(&ext->oe_link))
+                       cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts);
                unplug = true;
        }
        rc = 0;
@@ -2830,10 +2831,9 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj,
                                        ext->oe_urgent = 1;
                                        list = &obj->oo_urgent_exts;
                                }
-                               if (list != NULL) {
+                               if (list != NULL)
                                        cfs_list_move_tail(&ext->oe_link, list);
-                                       unplug = true;
-                               }
+                               unplug = true;
                        } else {
                                /* the only discarder is lock cancelling, so
                                 * [start, end] must contain this extent */