From: wangdi Date: Mon, 30 Mar 2009 19:54:57 +0000 (+0000) Subject: Branch: HEAD X-Git-Tag: v1_9_167~55 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=49f3a017b8425a3e03d0f7dd5d8dd27fa69f7c9f;hp=bc0cfd10c6f8e772c906e7318b4bf66e94859af2;ds=sidebyside Branch: HEAD b:18794 remove event if there are no obd registered under that event. i=Ericm,Huanghua --- diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index dace885..b1dcac3 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -1287,7 +1287,8 @@ int ptlrpc_pinger_del_import(struct obd_import *imp); int ptlrpc_add_timeout_client(int time, enum timeout_event event, timeout_cb_t cb, void *data, struct list_head *obd_list); -int ptlrpc_del_timeout_client(struct list_head *obd_list); +int ptlrpc_del_timeout_client(struct list_head *obd_list, + enum timeout_event event); struct ptlrpc_request * ptlrpc_prep_ping(struct obd_import *imp); int ptlrpc_obd_ping(struct obd_device *obd); cfs_time_t ptlrpc_suspend_wakeup_time(void); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 9e34a2c..f44f44b 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1031,7 +1031,8 @@ static int osc_add_shrink_grant(struct client_obd *client) static int osc_del_shrink_grant(struct client_obd *client) { - return ptlrpc_del_timeout_client(&client->cl_grant_shrink_list); + return ptlrpc_del_timeout_client(&client->cl_grant_shrink_list, + TIMEOUT_GRANT); } static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 113bf37..af1924a 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -519,10 +519,30 @@ int ptlrpc_add_timeout_client(int time, enum timeout_event event, return 0; } -int ptlrpc_del_timeout_client(struct list_head *obd_list) +int ptlrpc_del_timeout_client(struct list_head *obd_list, + enum timeout_event event) { + struct timeout_item *ti = NULL, *item; + + if (list_empty(obd_list)) + return 0; mutex_down(&pinger_sem); list_del_init(obd_list); + /** + * If there are no obd attached to the timeout event + * list, remove this timeout event from the pinger + */ + list_for_each_entry(item, &timeout_list, ti_chain) { + if (item->ti_event == event) { + ti = item; + break; + } + } + LASSERTF(ti != NULL, "ti is NULL ! \n"); + if (list_empty(&ti->ti_obd_list)) { + list_del(&ti->ti_chain); + OBD_FREE_PTR(ti); + } mutex_up(&pinger_sem); return 0; } @@ -893,7 +913,8 @@ int ptlrpc_add_timeout_client(int time, enum timeout_event event, return 0; } -int ptlrpc_del_timeout_client(struct list_head *obd_list) +int ptlrpc_del_timeout_client(struct list_head *obd_list, + enum timeout_event event) { return 0; }