two smb3 client fixes

-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmdvFZoACgkQiiy9cAdy
 T1G8Dwv7BTbNyC3nm0ntzHmZ++s44tJ6F+sagXZ3iBHlkK5lSRMys0dMH5DY8JPl
 WnzJZeN99E70vzLlOnsYeIl9ZyJxyEf2jWRFVK6fgnaNVl0OquTpdGp1yC0lJpQ+
 AFGhIb+zZaYd3YEgMlm/9gnuzJ9u1+xnI7wGXw/MSnvsbolFf9iwYrgUveAuNDhH
 3ztvcBoC8lI9TFTFXG1aDjhh0yCfY1Fk3heS1Lc1p7xj3uA11XOFSI4N0PlDsdGz
 Irs1ypRQDDjFI3Hazi8+hjrQA9P3Qg88AT0nsRWEy1XkoDh8rMZ48bOGeF3EjtFI
 rlB1IUDHqgIc0M9aZw06TL59fJPinWFCcYT7jq9AoNquebFKhXwyFkx4kqNBNa7s
 vp+ttUo3idfMwESWVWdPftD8KFdEkzzTQnQJMwbRKRWJ25WA/ysCadqb+DRMA3Lj
 qL1yWpwtAT1kU1noTKBpzPjZn17vLJd91auHZ2PkamgFcQmAyMV3A/BpQis6BGDM
 32WE9Rag
 =y/jk
 -----END PGP SIGNATURE-----

Merge tag '6.13-rc4-SMB3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - fix caching of files that will be reused for write

 - minor cleanup

* tag '6.13-rc4-SMB3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: Remove unused is_server_using_iface()
  smb: enable reuse of deferred file handles for write operations
This commit is contained in:
Linus Torvalds 2024-12-28 10:58:01 -08:00
commit e51da4a232
3 changed files with 5 additions and 28 deletions

View File

@ -614,8 +614,6 @@ int cifs_alloc_hash(const char *name, struct shash_desc **sdesc);
void cifs_free_hash(struct shash_desc **sdesc);
int cifs_try_adding_channels(struct cifs_ses *ses);
bool is_server_using_iface(struct TCP_Server_Info *server,
struct cifs_server_iface *iface);
bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface);
void cifs_ses_mark_for_reconnect(struct cifs_ses *ses);

View File

@ -990,7 +990,11 @@ int cifs_open(struct inode *inode, struct file *file)
}
/* Get the cached handle as SMB2 close is deferred */
rc = cifs_get_readable_path(tcon, full_path, &cfile);
if (OPEN_FMODE(file->f_flags) & FMODE_WRITE) {
rc = cifs_get_writable_path(tcon, full_path, FIND_WR_FSUID_ONLY, &cfile);
} else {
rc = cifs_get_readable_path(tcon, full_path, &cfile);
}
if (rc == 0) {
if (file->f_flags == cfile->f_flags) {
file->private_data = cfile;

View File

@ -27,31 +27,6 @@ static int
cifs_ses_add_channel(struct cifs_ses *ses,
struct cifs_server_iface *iface);
bool
is_server_using_iface(struct TCP_Server_Info *server,
struct cifs_server_iface *iface)
{
struct sockaddr_in *i4 = (struct sockaddr_in *)&iface->sockaddr;
struct sockaddr_in6 *i6 = (struct sockaddr_in6 *)&iface->sockaddr;
struct sockaddr_in *s4 = (struct sockaddr_in *)&server->dstaddr;
struct sockaddr_in6 *s6 = (struct sockaddr_in6 *)&server->dstaddr;
if (server->dstaddr.ss_family != iface->sockaddr.ss_family)
return false;
if (server->dstaddr.ss_family == AF_INET) {
if (s4->sin_addr.s_addr != i4->sin_addr.s_addr)
return false;
} else if (server->dstaddr.ss_family == AF_INET6) {
if (memcmp(&s6->sin6_addr, &i6->sin6_addr,
sizeof(i6->sin6_addr)) != 0)
return false;
} else {
/* unknown family.. */
return false;
}
return true;
}
bool is_ses_using_iface(struct cifs_ses *ses, struct cifs_server_iface *iface)
{
int i;