Hi Long, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on cifs/for-next] [also build test WARNING on v4.17-rc4 next-20180507] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Long-Li/cifs-smbd-Make-upper-layer-decide-when-to-destroy-the-transport/20180508-110150 base: git://git.samba.org/sfrench/cifs-2.6.git for-next config: i386-randconfig-a1-05080831 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): fs//cifs/connect.c: In function 'cifs_reconnect': >> fs//cifs/connect.c:381:16: warning: passing argument 1 of 'smbd_destroy' from incompatible pointer type smbd_destroy(server); ^ In file included from fs//cifs/connect.c:58:0: fs//cifs/smbdirect.h:334:20: note: expected 'struct smbd_connection *' but argument is of type 'struct TCP_Server_Info *' static inline void smbd_destroy(struct smbd_connection *info) {} ^ fs//cifs/connect.c: In function 'clean_demultiplex_info': fs//cifs/connect.c:715:16: warning: passing argument 1 of 'smbd_destroy' from incompatible pointer type smbd_destroy(server); ^ In file included from fs//cifs/connect.c:58:0: fs//cifs/smbdirect.h:334:20: note: expected 'struct smbd_connection *' but argument is of type 'struct TCP_Server_Info *' static inline void smbd_destroy(struct smbd_connection *info) {} ^ vim +/smbd_destroy +381 fs//cifs/connect.c 312 313 static int ip_connect(struct TCP_Server_Info *server); 314 static int generic_ip_connect(struct TCP_Server_Info *server); 315 static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink); 316 static void cifs_prune_tlinks(struct work_struct *work); 317 static int cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data, 318 const char *devname); 319 320 /* 321 * cifs tcp session reconnection 322 * 323 * mark tcp session as reconnecting so temporarily locked 324 * mark all smb sessions as reconnecting for tcp session 325 * reconnect tcp session 326 * wake up waiters on reconnection? - (not needed currently) 327 */ 328 int 329 cifs_reconnect(struct TCP_Server_Info *server) 330 { 331 int rc = 0; 332 struct list_head *tmp, *tmp2; 333 struct cifs_ses *ses; 334 struct cifs_tcon *tcon; 335 struct mid_q_entry *mid_entry; 336 struct list_head retry_list; 337 338 spin_lock(&GlobalMid_Lock); 339 if (server->tcpStatus == CifsExiting) { 340 /* the demux thread will exit normally 341 next time through the loop */ 342 spin_unlock(&GlobalMid_Lock); 343 return rc; 344 } else 345 server->tcpStatus = CifsNeedReconnect; 346 spin_unlock(&GlobalMid_Lock); 347 server->maxBuf = 0; 348 server->max_read = 0; 349 350 cifs_dbg(FYI, "Reconnecting tcp session\n"); 351 352 /* before reconnecting the tcp session, mark the smb session (uid) 353 and the tid bad so they are not used until reconnected */ 354 cifs_dbg(FYI, "%s: marking sessions and tcons for reconnect\n", 355 __func__); 356 spin_lock(&cifs_tcp_ses_lock); 357 list_for_each(tmp, &server->smb_ses_list) { 358 ses = list_entry(tmp, struct cifs_ses, smb_ses_list); 359 ses->need_reconnect = true; 360 list_for_each(tmp2, &ses->tcon_list) { 361 tcon = list_entry(tmp2, struct cifs_tcon, tcon_list); 362 tcon->need_reconnect = true; 363 } 364 if (ses->tcon_ipc) 365 ses->tcon_ipc->need_reconnect = true; 366 } 367 spin_unlock(&cifs_tcp_ses_lock); 368 369 /* do not want to be sending data on a socket we are freeing */ 370 cifs_dbg(FYI, "%s: tearing down socket\n", __func__); 371 mutex_lock(&server->srv_mutex); 372 if (server->ssocket) { 373 cifs_dbg(FYI, "State: 0x%x Flags: 0x%lx\n", 374 server->ssocket->state, server->ssocket->flags); 375 kernel_sock_shutdown(server->ssocket, SHUT_WR); 376 cifs_dbg(FYI, "Post shutdown state: 0x%x Flags: 0x%lx\n", 377 server->ssocket->state, server->ssocket->flags); 378 sock_release(server->ssocket); 379 server->ssocket = NULL; 380 } else if (cifs_rdma_enabled(server)) > 381 smbd_destroy(server); 382 server->sequence_number = 0; 383 server->session_estab = false; 384 kfree(server->session_key.response); 385 server->session_key.response = NULL; 386 server->session_key.len = 0; 387 server->lstrp = jiffies; 388 389 /* mark submitted MIDs for retry and issue callback */ 390 INIT_LIST_HEAD(&retry_list); 391 cifs_dbg(FYI, "%s: moving mids to private list\n", __func__); 392 spin_lock(&GlobalMid_Lock); 393 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { 394 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 395 if (mid_entry->mid_state == MID_REQUEST_SUBMITTED) 396 mid_entry->mid_state = MID_RETRY_NEEDED; 397 list_move(&mid_entry->qhead, &retry_list); 398 } 399 spin_unlock(&GlobalMid_Lock); 400 mutex_unlock(&server->srv_mutex); 401 402 cifs_dbg(FYI, "%s: issuing mid callbacks\n", __func__); 403 list_for_each_safe(tmp, tmp2, &retry_list) { 404 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 405 list_del_init(&mid_entry->qhead); 406 mid_entry->callback(mid_entry); 407 } 408 409 do { 410 try_to_freeze(); 411 412 /* we should try only the port we connected to before */ 413 mutex_lock(&server->srv_mutex); 414 if (cifs_rdma_enabled(server)) 415 rc = smbd_reconnect(server); 416 else 417 rc = generic_ip_connect(server); 418 if (rc) { 419 cifs_dbg(FYI, "reconnect error %d\n", rc); 420 mutex_unlock(&server->srv_mutex); 421 msleep(3000); 422 } else { 423 atomic_inc(&tcpSesReconnectCount); 424 spin_lock(&GlobalMid_Lock); 425 if (server->tcpStatus != CifsExiting) 426 server->tcpStatus = CifsNeedNegotiate; 427 spin_unlock(&GlobalMid_Lock); 428 mutex_unlock(&server->srv_mutex); 429 } 430 } while (server->tcpStatus == CifsNeedReconnect); 431 432 if (server->tcpStatus == CifsNeedNegotiate) 433 mod_delayed_work(cifsiod_wq, &server->echo, 0); 434 435 return rc; 436 } 437 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip