#
16a57d76 |
| 13-Mar-2024 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: reduce warning log level for server not advertising interfaces
Several users have reported this log getting dumped too regularly to kernel log. The likely root cause has been identified, and i
cifs: reduce warning log level for server not advertising interfaces
Several users have reported this log getting dumped too regularly to kernel log. The likely root cause has been identified, and it suggests that this situation is expected for some configurations (for example SMB2.1).
Since the function returns appropriately even for such cases, it is fairly harmless to make this a debug log. When needed, the verbosity can be increased to capture this log.
Cc: stable@vger.kernel.org Reported-by: Jan Čermák <sairon@sairon.cz> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
a39c757b |
| 06-Feb-2024 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: handle cases where multiple sessions share connection
Based on our implementation of multichannel, it is entirely possible that a server struct may not be found in any channel of an SMB sessio
cifs: handle cases where multiple sessions share connection
Based on our implementation of multichannel, it is entirely possible that a server struct may not be found in any channel of an SMB session.
In such cases, we should be prepared to move on and search for the server struct in the next session.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
45be0882 |
| 05-Feb-2024 |
Steve French <stfrench@microsoft.com> |
smb3: add missing null server pointer check
Address static checker warning in cifs_ses_get_chan_index(): warn: variable dereferenced before check 'server' To be consistent, and reduce risk, we s
smb3: add missing null server pointer check
Address static checker warning in cifs_ses_get_chan_index(): warn: variable dereferenced before check 'server' To be consistent, and reduce risk, we should add another check for null server pointer.
Fixes: 88675b22d34e ("cifs: do not search for channel if server is terminating") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
6aac002b |
| 01-Feb-2024 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: failure to add channel on iface should bump up weight
After the interface selection policy change to do a weighted round robin, each iface maintains a weight_fulfilled. When the weight_fulfill
cifs: failure to add channel on iface should bump up weight
After the interface selection policy change to do a weighted round robin, each iface maintains a weight_fulfilled. When the weight_fulfilled reaches the total weight for the iface, we know that the weights can be reset and ifaces can be allocated from scratch again.
During channel allocation failures on a particular channel, weight_fulfilled is not incremented. If a few interfaces are inactive, we could end up in a situation where the active interfaces are all allocated for the total_weight, and inactive ones are all that remain. This can cause a situation where no more channels can be allocated further.
This change fixes it by increasing weight_fulfilled, even when channel allocation failure happens. This could mean that if there are temporary failures in channel allocation, the iface weights may not strictly be adhered to. But that's still okay.
Fixes: a6d8fb54a515 ("cifs: distribute channels across interfaces based on speed") Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
88675b22 |
| 01-Feb-2024 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: do not search for channel if server is terminating
In order to scale down the channels, the following sequence of operations happen: 1. server struct is marked for terminate 2. the channel is
cifs: do not search for channel if server is terminating
In order to scale down the channels, the following sequence of operations happen: 1. server struct is marked for terminate 2. the channel is deallocated in the ses->chans array 3. at a later point the cifsd thread actually terminates the server
Between 2 and 3, there can be calls to find the channel for a server struct. When that happens, there can be an ugly warning that's logged. But this is expected.
So this change does two things: 1. in cifs_ses_get_chan_index, if server->terminate is set, return 2. always make sure server->terminate is set with chan_lock held
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
a3f763fd |
| 09-Jan-2024 |
Steve French <stfrench@microsoft.com> |
cifs: remove unneeded return statement
Return statement was not needed at end of cifs_chan_update_iface
Suggested-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Signed-off-by: Steve French
cifs: remove unneeded return statement
Return statement was not needed at end of cifs_chan_update_iface
Suggested-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
8d606c31 |
| 08-Jan-2024 |
Dan Carpenter <dan.carpenter@linaro.org> |
cifs: make cifs_chan_update_iface() a void function
The return values for cifs_chan_update_iface() didn't match what the documentation said and nothing was checking them anyway. Just make it a void
cifs: make cifs_chan_update_iface() a void function
The return values for cifs_chan_update_iface() didn't match what the documentation said and nothing was checking them anyway. Just make it a void function.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
c3a11c0e |
| 08-Jan-2024 |
Dan Carpenter <dan.carpenter@linaro.org> |
cifs: delete unnecessary NULL checks in cifs_chan_update_iface()
We return early if "iface" is NULL so there is no need to check here. Delete those checks.
Signed-off-by: Dan Carpenter <dan.carpent
cifs: delete unnecessary NULL checks in cifs_chan_update_iface()
We return early if "iface" is NULL so there is no need to check here. Delete those checks.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
516eea97 |
| 29-Dec-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: fix in logging in cifs_chan_update_iface
Recently, cifs_chan_update_iface was modified to not remove an iface if a suitable replacement was not found. With that, there were two conditionals th
cifs: fix in logging in cifs_chan_update_iface
Recently, cifs_chan_update_iface was modified to not remove an iface if a suitable replacement was not found. With that, there were two conditionals that were exactly the same. This change removes that extra condition check.
Also, fixed a logging in the same function to indicate the correct message.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
12d1e301 |
| 15-Dec-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: do not let cifs_chan_update_iface deallocate channels
cifs_chan_update_iface is meant to check and update the server interface used for a channel when the existing server interface is no longe
cifs: do not let cifs_chan_update_iface deallocate channels
cifs_chan_update_iface is meant to check and update the server interface used for a channel when the existing server interface is no longer available.
So far, this handler had the code to remove an interface entry even if a new candidate interface is not available. Allowing this leads to several corner cases to handle.
This change makes the logic much simpler by not deallocating the current channel interface entry if a new interface is not found to replace it with.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
a15ccef8 |
| 21-Nov-2023 |
Ritvik Budhiraja <rbudhiraja@microsoft.com> |
cifs: fix use after free for iface while disabling secondary channels
We were deferencing iface after it has been released. Fix is to release after all dereference instances have been encountered.
cifs: fix use after free for iface while disabling secondary channels
We were deferencing iface after it has been released. Fix is to release after all dereference instances have been encountered.
Signed-off-by: Ritvik Budhiraja <rbudhiraja@microsoft.com> Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <error27@gmail.com> Closes: https://lore.kernel.org/r/202311110815.UJaeU3Tt-lkp@intel.com/ Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
5eef12c4 |
| 14-Nov-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: fix lock ordering while disabling multichannel
The code to handle the case of server disabling multichannel was picking iface_lock with chan_lock held. This goes against the lock ordering rule
cifs: fix lock ordering while disabling multichannel
The code to handle the case of server disabling multichannel was picking iface_lock with chan_lock held. This goes against the lock ordering rules, as iface_lock is a higher order lock (even if it isn't so obvious).
This change fixes the lock ordering by doing the following in that order for each secondary channel: 1. store iface and server pointers in local variable 2. remove references to iface and server in channels 3. unlock chan_lock 4. lock iface_lock 5. dec ref count for iface 6. unlock iface_lock 7. dec ref count for server 8. lock chan_lock again
Since this function can only be called in smb2_reconnect, and that cannot be called by two parallel processes, we should not have races due to dropping chan_lock between steps 3 and 8.
Fixes: ee1d21794e55 ("cifs: handle when server stops supporting multichannel") Reported-by: Paulo Alcantara <pc@manguebit.com> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
ee1d2179 |
| 13-Oct-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: handle when server stops supporting multichannel
When a server stops supporting multichannel, we will keep attempting reconnects to the secondary channels today. Avoid this by freeing extra ch
cifs: handle when server stops supporting multichannel
When a server stops supporting multichannel, we will keep attempting reconnects to the secondary channels today. Avoid this by freeing extra channels when negotiate returns no multichannel support.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
f72d9650 |
| 06-Nov-2023 |
Steve French <stfrench@microsoft.com> |
smb3: minor cleanup of session handling code
Minor cleanup of style issues found by checkpatch
Reviewed-by: Bharath SM <bharathsm@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
|
#
9599d59e |
| 06-Nov-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: do not pass cifs_sb when trying to add channels
The only reason why cifs_sb gets passed today to cifs_try_adding_channels is to pass the local_nls field for the new channels and binding sessio
cifs: do not pass cifs_sb when trying to add channels
The only reason why cifs_sb gets passed today to cifs_try_adding_channels is to pass the local_nls field for the new channels and binding session. However, the ses struct already has local_nls field that is setup during the first cifs_setup_session. So there is no need to pass cifs_sb.
This change removes cifs_sb from the arg list for this and the functions that it calls and uses ses->local_nls instead.
Cc: stable@vger.kernel.org Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
fa1d0508 |
| 14-Mar-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: account for primary channel in the interface list
The refcounting of server interfaces should account for the primary channel too. Although this is not strictly necessary, doing so will accoun
cifs: account for primary channel in the interface list
The refcounting of server interfaces should account for the primary channel too. Although this is not strictly necessary, doing so will account for the primary channel in DebugData.
Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
a6d8fb54 |
| 26-Dec-2022 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: distribute channels across interfaces based on speed
Today, if the server interfaces RSS capable, we simply choose the fastest interface to setup a channel. This is not a scalable approach, an
cifs: distribute channels across interfaces based on speed
Today, if the server interfaces RSS capable, we simply choose the fastest interface to setup a channel. This is not a scalable approach, and does not make a lot of attempt to distribute the connections.
This change does a weighted distribution of channels across all the available server interfaces, where the weight is a function of the advertised interface speed.
Also make sure that we don't mix rdma and non-rdma for channels.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
0c51cc6f |
| 13-Oct-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: handle cases where a channel is closed
So far, SMB multichannel could only scale up, but not scale down the number of channels. In this series of patch, we now allow the client to deal with th
cifs: handle cases where a channel is closed
So far, SMB multichannel could only scale up, but not scale down the number of channels. In this series of patch, we now allow the client to deal with the case of multichannel disabled on the server when the share is mounted. With that change, we now need the ability to scale down the channels.
This change allows the client to deal with cases of missing channels more gracefully.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
1bc081b6 |
| 07-Nov-2023 |
Steve French <stfrench@microsoft.com> |
smb3: more minor cleanups for session handling routines
Some trivial cleanup pointed out by checkpatch
Reviewed-by: Bharath SM <bharathsm@microsoft.com> Signed-off-by: Steve French <stfrench@micros
smb3: more minor cleanups for session handling routines
Some trivial cleanup pointed out by checkpatch
Reviewed-by: Bharath SM <bharathsm@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
6e5e64c9 |
| 30-Oct-2023 |
Shyam Prasad N <sprasad@microsoft.com> |
cifs: do not reset chan_max if multichannel is not supported at mount
If the mount command has specified multichannel as a mount option, but multichannel is found to be unsupported by the server at
cifs: do not reset chan_max if multichannel is not supported at mount
If the mount command has specified multichannel as a mount option, but multichannel is found to be unsupported by the server at the time of mount, we set chan_max to 1. Which means that the user needs to remount the share if the server starts supporting multichannel.
This change removes this reset. What it means is that if the user specified multichannel or max_channels during mount, and at this time, multichannel is not supported, but the server starts supporting it at a later point, the client will be capable of scaling out the number of channels.
Cc: stable@vger.kernel.org Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
1460720c |
| 04-Oct-2023 |
Meetakshi Setiya <msetiya@microsoft.com> |
cifs: Add client version details to NTLM authenticate message
The NTLM authenticate message currently sets the NTLMSSP_NEGOTIATE_VERSION flag but does not populate the VERSION structure. This commit
cifs: Add client version details to NTLM authenticate message
The NTLM authenticate message currently sets the NTLMSSP_NEGOTIATE_VERSION flag but does not populate the VERSION structure. This commit fixes this bug by ensuring that the flag is set and the version details are included in the message.
Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com> Reviewed-by: Bharath SM <bharathsm@microsoft.com> Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
b3773b19 |
| 25-Aug-2023 |
Steve French <stfrench@microsoft.com> |
SMB3: rename macro CIFS_SERVER_IS_CHAN to avoid confusion
Since older dialects such as CIFS do not support multichannel the macro CIFS_SERVER_IS_CHAN can be confusing (it requires SMB 3 or later) so
SMB3: rename macro CIFS_SERVER_IS_CHAN to avoid confusion
Since older dialects such as CIFS do not support multichannel the macro CIFS_SERVER_IS_CHAN can be confusing (it requires SMB 3 or later) so shorten its name to "SERVER_IS_CHAN"
Suggested-by: Tom Talpey <tom@talpey.com> Acked-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
69a4e06c |
| 17-Aug-2023 |
Paulo Alcantara <pc@manguebit.com> |
smb: client: reduce stack usage in cifs_try_adding_channels()
Clang warns about exceeded stack frame size
fs/smb/client/sess.c:160:5: warning: stack frame size (1368) exceeds limit (1024) in 'c
smb: client: reduce stack usage in cifs_try_adding_channels()
Clang warns about exceeded stack frame size
fs/smb/client/sess.c:160:5: warning: stack frame size (1368) exceeds limit (1024) in 'cifs_try_adding_channels' [-Wframe-larger-than]
It turns out that cifs_ses_add_channel() got inlined into cifs_try_adding_channels() which had a stack-allocated variable @ctx of 624 bytes in size. Fix this by making it heap-allocated.
Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202307270640.5ODmPwDl-lkp@intel.com/ Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
19826558 |
| 25-Jul-2023 |
Steve French <stfrench@microsoft.com> |
smb3: do not set NTLMSSP_VERSION flag for negotiate not auth request
The NTLMSSP_NEGOTIATE_VERSION flag only needs to be sent during the NTLMSSP NEGOTIATE (not the AUTH) request, so filter it out fo
smb3: do not set NTLMSSP_VERSION flag for negotiate not auth request
The NTLMSSP_NEGOTIATE_VERSION flag only needs to be sent during the NTLMSSP NEGOTIATE (not the AUTH) request, so filter it out for NTLMSSP AUTH requests. See MS-NLMP 2.2.1.3
This fixes a problem found by the gssntlmssp server.
Link: https://github.com/gssapi/gss-ntlmssp/issues/95 Fixes: 52d005337b2c ("smb3: send NTLMSSP version information") Acked-by: Roy Shterman <roy.shterman@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|
#
38c8a9a5 |
| 22-May-2023 |
Steve French <stfrench@microsoft.com> |
smb: move client and server files to common directory fs/smb
Move CIFS/SMB3 related client and server files (cifs.ko and ksmbd.ko and helper modules) to new fs/smb subdirectory:
fs/cifs --> fs/s
smb: move client and server files to common directory fs/smb
Move CIFS/SMB3 related client and server files (cifs.ko and ksmbd.ko and helper modules) to new fs/smb subdirectory:
fs/cifs --> fs/smb/client fs/ksmbd --> fs/smb/server fs/smbfs_common --> fs/smb/common
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
show more ...
|