Skip to content

Commit 072a28c

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: do not poll server interfaces too regularly
We have the server interface list hanging off the tcon structure today for reasons unknown. So each tcon which is connected to a file server can query them separately, which is really unnecessary. To avoid this, in the query function, we will check the time of last update of the interface list, and avoid querying the server if it is within a certain range. Signed-off-by: Shyam Prasad N <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent 2f4e429 commit 072a28c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

fs/cifs/smb2ops.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,14 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
530530
p = buf;
531531

532532
spin_lock(&ses->iface_lock);
533+
/* do not query too frequently, this time with lock held */
534+
if (ses->iface_last_update &&
535+
time_before(jiffies, ses->iface_last_update +
536+
(SMB_INTERFACE_POLL_INTERVAL * HZ))) {
537+
spin_unlock(&ses->iface_lock);
538+
return 0;
539+
}
540+
533541
/*
534542
* Go through iface_list and do kref_put to remove
535543
* any unused ifaces. ifaces in use will be removed
@@ -696,6 +704,12 @@ SMB3_request_interfaces(const unsigned int xid, struct cifs_tcon *tcon, bool in_
696704
struct network_interface_info_ioctl_rsp *out_buf = NULL;
697705
struct cifs_ses *ses = tcon->ses;
698706

707+
/* do not query too frequently */
708+
if (ses->iface_last_update &&
709+
time_before(jiffies, ses->iface_last_update +
710+
(SMB_INTERFACE_POLL_INTERVAL * HZ)))
711+
return 0;
712+
699713
rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
700714
FSCTL_QUERY_NETWORK_INTERFACE_INFO,
701715
NULL /* no data input */, 0 /* no data input */,

0 commit comments

Comments
 (0)