[bug report] forever loop in ksocknal_push()
Zhen, Liang
liang.zhen at intel.com
Mon Apr 28 15:32:56 UTC 2014
Yes, it is indeed a deadloop, I think we didn¹t catch it because it¹s only
called by an utility command which is probably never tried by anyone.
I have posted a patch for it: http://review.whamcloud.com/10128
Thanks
Liang
On 4/28/14, 2:38 AM, "Drokin, Oleg" <oleg.drokin at intel.com> wrote:
>Thanks!
>
>Liang, any comments about this?
>
>On Apr 27, 2014, at 2:26 PM, Dan Carpenter wrote:
>
>> Hello Peng Tao,
>>
>> The patch d7e09d0397e8: "staging: add Lustre file system client
>> support" from May 2, 2013, leads to the following static checker
>> warning:
>>
>> drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:1904
>>ksocknal_push()
>> info: ignoring unreachable code.
>>
>> drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
>> 1904 for (i = 0; i < ksocknal_data.ksnd_peer_hash_size; i++) {
>> ^^^
>> Not reached.
>>
>> 1905 for (j = 0; ; j++) {
>> ^^^^^^^^^^^^
>> This loop is a forever loop. No break statements or exit conditions. I
>> don't know how to fix this.
>>
>> 1906
>>read_lock(&ksocknal_data.ksnd_global_lock);
>> 1907
>> 1908 index = 0;
>> 1909 peer = NULL;
>> 1910
>> 1911 list_for_each (tmp,
>>&ksocknal_data.ksnd_peers[i]) {
>> 1912 peer = list_entry(tmp,
>>ksock_peer_t,
>> 1913 ksnp_list);
>> 1914
>> 1915 if (!((id.nid == LNET_NID_ANY ||
>> 1916 id.nid ==
>>peer->ksnp_id.nid) &&
>> 1917 (id.pid == LNET_PID_ANY ||
>> 1918 id.pid ==
>>peer->ksnp_id.pid))) {
>> 1919 peer = NULL;
>> 1920 continue;
>> 1921 }
>> 1922
>> 1923 if (index++ == j) {
>> 1924
>>ksocknal_peer_addref(peer);
>> 1925 break;
>> 1926 }
>> 1927 }
>> 1928
>> 1929
>>read_unlock(&ksocknal_data.ksnd_global_lock);
>> 1930
>> 1931 if (peer != NULL) {
>> 1932 rc = 0;
>> 1933 ksocknal_push_peer (peer);
>> 1934 ksocknal_peer_decref(peer);
>> 1935 }
>> 1936 }
>> 1937
>> 1938 }
>>
>> regards,
>> dan carpenter
>>
>
More information about the devel
mailing list