]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/fs-writeback.c
writeback: fix possible bdi writeback refcounting problem
[net-next-2.6.git] / fs / fs-writeback.c
index 7eba7326b9b95568913ef0b774a44b20bd4b8e5f..8e1e5e19d21e1fd60c9f99b3988fee0191c3e901 100644 (file)
@@ -97,6 +97,11 @@ static void bdi_work_clear(struct bdi_work *work)
 {
        clear_bit(WS_USED_B, &work->state);
        smp_mb__after_clear_bit();
+       /*
+        * work can have disappeared at this point. bit waitq functions
+        * should be able to tolerate this, provided bdi_sched_wait does
+        * not dereference it's pointer argument.
+       */
        wake_up_bit(&work->state, WS_USED_B);
 }
 
@@ -169,13 +174,7 @@ static void bdi_queue_work(struct backing_dev_info *bdi, struct bdi_work *work)
        else {
                struct bdi_writeback *wb = &bdi->wb;
 
-               /*
-                * End work now if this wb has no dirty IO pending. Otherwise
-                * wakeup the handling thread
-                */
-               if (!wb_has_dirty_io(wb))
-                       wb_clear_pending(wb, work);
-               else if (wb->task)
+               if (wb->task)
                        wake_up_process(wb->task);
        }
 }