]> Git Repo - linux.git/commitdiff
cifs: fix interface count calculation during refresh
authorShyam Prasad N <[email protected]>
Thu, 22 Dec 2022 12:54:44 +0000 (12:54 +0000)
committerSteve French <[email protected]>
Thu, 5 Jan 2023 05:18:07 +0000 (23:18 -0600)
The last fix to iface_count did fix the overcounting issue.
However, during each refresh, we could end up undercounting
the iface_count, if a match was found.

Fixing this by doing increments and decrements instead of
setting it to 0 before each parsing of server interfaces.

Fixes: 096bbeec7bd6 ("smb3: interface count displayed incorrectly")
Cc: [email protected] # 6.1
Signed-off-by: Shyam Prasad N <[email protected]>
Reviewed-by: Paulo Alcantara (SUSE) <[email protected]>
Signed-off-by: Steve French <[email protected]>
fs/cifs/smb2ops.c

index 0d7e9bcd9f345cc201dd31b3406ff68029071004..e6bcd2baf446a93a25ca3613029a960edd5137b9 100644 (file)
@@ -530,7 +530,6 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
        p = buf;
 
        spin_lock(&ses->iface_lock);
-       ses->iface_count = 0;
        /*
         * Go through iface_list and do kref_put to remove
         * any unused ifaces. ifaces in use will be removed
@@ -540,6 +539,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
                                 iface_head) {
                iface->is_active = 0;
                kref_put(&iface->refcount, release_iface);
+               ses->iface_count--;
        }
        spin_unlock(&ses->iface_lock);
 
@@ -618,6 +618,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
                                /* just get a ref so that it doesn't get picked/freed */
                                iface->is_active = 1;
                                kref_get(&iface->refcount);
+                               ses->iface_count++;
                                spin_unlock(&ses->iface_lock);
                                goto next_iface;
                        } else if (ret < 0) {
This page took 0.06391 seconds and 4 git commands to generate.