From: Niu Yawei Date: Sat, 22 Oct 2011 08:16:55 +0000 (+0800) Subject: LU-753 obdfilter: improper LASSERT in filter_commitrw_write() X-Git-Tag: 2.1.52~40 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0935fc8eae15696820f87951d8955a9c8bc66177 LU-753 obdfilter: improper LASSERT in filter_commitrw_write() In rare cases fsfilt_commit_wait() will wake up and return after the transaction has finished its work and updated j_commit_sequence but the commit callbacks have not been run yet. Which will trigger the LASSERT(oti->oti_transno <= obd->obd_last_committed) improperly. We should just wait for the commit callback finished instead of put an improper LASSERT here. Signed-off-by: Niu Yawei Change-Id: Ibd5add8d352d2e7598be49b0bf8fa37d40ce6e1f Reviewed-on: http://review.whamcloud.com/1583 Reviewed-by: Andreas Dilger Tested-by: Hudson Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index a15884a..cc0d72c 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -785,10 +785,28 @@ retry: rc = err; } - if (obd->obd_replayable && !rc && wait_handle) - LASSERTF(oti->oti_transno <= obd->obd_last_committed, - "oti_transno "LPU64" last_committed "LPU64"\n", - oti->oti_transno, obd->obd_last_committed); + /* In rare cases fsfilt_commit_wait() will wake up and return after + * the transaction has finished its work and updated j_commit_sequence + * but the commit callbacks have not been run yet. Wait here until + * that is finished so that clients requesting sync IO don't see the + * reply transno < last_committed. LU-753 */ + if (unlikely(obd->obd_replayable && !rc && wait_handle && + oti->oti_transno > obd->obd_last_committed)) { + cfs_waitq_t wq; + struct l_wait_info lwi = + LWI_TIMEOUT_INTERVAL(cfs_time_seconds(5), + (cfs_duration_t)((HZ + 4)/5), + NULL, NULL); + cfs_waitq_init(&wq); + l_wait_event(wq, + oti->oti_transno <= obd->obd_last_committed, + &lwi); + + /* commit callback isn't done after waiting for 5 secs ? */ + if (unlikely(oti->oti_transno > obd->obd_last_committed)) + CERROR("transno:"LPU64" > last_committed:"LPU64"\n", + oti->oti_transno, obd->obd_last_committed); + } fsfilt_check_slow(obd, now, "commitrw commit");