Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '5.18-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6

Pull cfis updates from Steve French:
"Handlecache, unmount, fiemap and two reconnect fixes"

* tag '5.18-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6:
cifs: use a different reconnect helper for non-cifsd threads
cifs: we do not need a spinlock around the tree access during umount
Adjust cifssb maximum read size
cifs: truncate the inode and mapping when we simulate fcollapse
cifs: fix handlecache and multiuser

+85 -14
+3 -3
fs/cifs/cifs_swn.c
··· 396 396 switch (state) { 397 397 case CIFS_SWN_RESOURCE_STATE_UNAVAILABLE: 398 398 cifs_dbg(FYI, "%s: resource name '%s' become unavailable\n", __func__, name); 399 - cifs_mark_tcp_ses_conns_for_reconnect(swnreg->tcon->ses->server, true); 399 + cifs_signal_cifsd_for_reconnect(swnreg->tcon->ses->server, true); 400 400 break; 401 401 case CIFS_SWN_RESOURCE_STATE_AVAILABLE: 402 402 cifs_dbg(FYI, "%s: resource name '%s' become available\n", __func__, name); 403 - cifs_mark_tcp_ses_conns_for_reconnect(swnreg->tcon->ses->server, true); 403 + cifs_signal_cifsd_for_reconnect(swnreg->tcon->ses->server, true); 404 404 break; 405 405 case CIFS_SWN_RESOURCE_STATE_UNKNOWN: 406 406 cifs_dbg(FYI, "%s: resource name '%s' changed to unknown state\n", __func__, name); ··· 498 498 goto unlock; 499 499 } 500 500 501 - cifs_mark_tcp_ses_conns_for_reconnect(tcon->ses->server, false); 501 + cifs_signal_cifsd_for_reconnect(tcon->ses->server, false); 502 502 503 503 unlock: 504 504 mutex_unlock(&tcon->ses->server->srv_mutex);
+11 -3
fs/cifs/cifsfs.c
··· 210 210 if (rc) 211 211 goto out_no_root; 212 212 /* tune readahead according to rsize if readahead size not set on mount */ 213 + if (cifs_sb->ctx->rsize == 0) 214 + cifs_sb->ctx->rsize = 215 + tcon->ses->server->ops->negotiate_rsize(tcon, cifs_sb->ctx); 213 216 if (cifs_sb->ctx->rasize) 214 217 sb->s_bdi->ra_pages = cifs_sb->ctx->rasize / PAGE_SIZE; 215 218 else ··· 257 254 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 258 255 struct cifs_tcon *tcon; 259 256 struct cached_fid *cfid; 257 + struct rb_root *root = &cifs_sb->tlink_tree; 258 + struct rb_node *node; 259 + struct tcon_link *tlink; 260 260 261 261 /* 262 262 * We ned to release all dentries for the cached directories ··· 269 263 dput(cifs_sb->root); 270 264 cifs_sb->root = NULL; 271 265 } 272 - tcon = cifs_sb_master_tcon(cifs_sb); 273 - if (tcon) { 266 + node = rb_first(root); 267 + while (node != NULL) { 268 + tlink = rb_entry(node, struct tcon_link, tl_rbnode); 269 + tcon = tlink_tcon(tlink); 274 270 cfid = &tcon->crfid; 275 271 mutex_lock(&cfid->fid_mutex); 276 272 if (cfid->dentry) { 277 - 278 273 dput(cfid->dentry); 279 274 cfid->dentry = NULL; 280 275 } 281 276 mutex_unlock(&cfid->fid_mutex); 277 + node = rb_next(node); 282 278 } 283 279 284 280 kill_anon_super(sb);
+3
fs/cifs/cifsproto.h
··· 132 132 struct smb_hdr *out_buf, 133 133 int *bytes_returned); 134 134 void 135 + cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, 136 + bool all_channels); 137 + void 135 138 cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server, 136 139 bool mark_smb_session); 137 140 extern int cifs_reconnect(struct TCP_Server_Info *server,
+41 -1
fs/cifs/connect.c
··· 163 163 } 164 164 165 165 /* 166 + * Update the tcpStatus for the server. 167 + * This is used to signal the cifsd thread to call cifs_reconnect 168 + * ONLY cifsd thread should call cifs_reconnect. For any other 169 + * thread, use this function 170 + * 171 + * @server: the tcp ses for which reconnect is needed 172 + * @all_channels: if this needs to be done for all channels 173 + */ 174 + void 175 + cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, 176 + bool all_channels) 177 + { 178 + struct TCP_Server_Info *pserver; 179 + struct cifs_ses *ses; 180 + int i; 181 + 182 + /* If server is a channel, select the primary channel */ 183 + pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server; 184 + 185 + spin_lock(&cifs_tcp_ses_lock); 186 + if (!all_channels) { 187 + pserver->tcpStatus = CifsNeedReconnect; 188 + spin_unlock(&cifs_tcp_ses_lock); 189 + return; 190 + } 191 + 192 + list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) { 193 + spin_lock(&ses->chan_lock); 194 + for (i = 0; i < ses->chan_count; i++) 195 + ses->chans[i].server->tcpStatus = CifsNeedReconnect; 196 + spin_unlock(&ses->chan_lock); 197 + } 198 + spin_unlock(&cifs_tcp_ses_lock); 199 + } 200 + 201 + /* 166 202 * Mark all sessions and tcons for reconnect. 203 + * IMPORTANT: make sure that this gets called only from 204 + * cifsd thread. For any other thread, use 205 + * cifs_signal_cifsd_for_reconnect 167 206 * 207 + * @server: the tcp ses for which reconnect is needed 168 208 * @server needs to be previously set to CifsNeedReconnect. 169 - * 209 + * @mark_smb_session: whether even sessions need to be marked 170 210 */ 171 211 void 172 212 cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
+1 -1
fs/cifs/dfs_cache.c
··· 1355 1355 } 1356 1356 1357 1357 cifs_dbg(FYI, "%s: no cached or matched targets. mark dfs share for reconnect.\n", __func__); 1358 - cifs_mark_tcp_ses_conns_for_reconnect(tcon->ses->server, true); 1358 + cifs_signal_cifsd_for_reconnect(tcon->ses->server, true); 1359 1359 } 1360 1360 1361 1361 /* Refresh dfs referral of tcon and mark it for reconnect if needed */
+10
fs/cifs/file.c
··· 3740 3740 break; 3741 3741 } 3742 3742 3743 + if (cifs_sb->ctx->rsize == 0) 3744 + cifs_sb->ctx->rsize = 3745 + server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), 3746 + cifs_sb->ctx); 3747 + 3743 3748 rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, 3744 3749 &rsize, credits); 3745 3750 if (rc) ··· 4478 4473 break; 4479 4474 } 4480 4475 } 4476 + 4477 + if (cifs_sb->ctx->rsize == 0) 4478 + cifs_sb->ctx->rsize = 4479 + server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), 4480 + cifs_sb->ctx); 4481 4481 4482 4482 rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, 4483 4483 &rsize, credits);
+1 -1
fs/cifs/smb1ops.c
··· 228 228 spin_unlock(&GlobalMid_Lock); 229 229 230 230 if (reconnect) { 231 - cifs_mark_tcp_ses_conns_for_reconnect(server, false); 231 + cifs_signal_cifsd_for_reconnect(server, false); 232 232 } 233 233 234 234 return mid;
+14 -4
fs/cifs/smb2ops.c
··· 25 25 #include "smb2glob.h" 26 26 #include "cifs_ioctl.h" 27 27 #include "smbdirect.h" 28 + #include "fscache.h" 28 29 #include "fs_context.h" 29 30 30 31 /* Change credits for different ops and return the total number of credits */ ··· 3888 3887 { 3889 3888 int rc; 3890 3889 unsigned int xid; 3890 + struct inode *inode; 3891 3891 struct cifsFileInfo *cfile = file->private_data; 3892 + struct cifsInodeInfo *cifsi; 3892 3893 __le64 eof; 3893 3894 3894 3895 xid = get_xid(); 3895 3896 3896 - if (off >= i_size_read(file->f_inode) || 3897 - off + len >= i_size_read(file->f_inode)) { 3897 + inode = d_inode(cfile->dentry); 3898 + cifsi = CIFS_I(inode); 3899 + 3900 + if (off >= i_size_read(inode) || 3901 + off + len >= i_size_read(inode)) { 3898 3902 rc = -EINVAL; 3899 3903 goto out; 3900 3904 } 3901 3905 3902 3906 rc = smb2_copychunk_range(xid, cfile, cfile, off + len, 3903 - i_size_read(file->f_inode) - off - len, off); 3907 + i_size_read(inode) - off - len, off); 3904 3908 if (rc < 0) 3905 3909 goto out; 3906 3910 3907 - eof = cpu_to_le64(i_size_read(file->f_inode) - len); 3911 + eof = cpu_to_le64(i_size_read(inode) - len); 3908 3912 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, 3909 3913 cfile->fid.volatile_fid, cfile->pid, &eof); 3910 3914 if (rc < 0) 3911 3915 goto out; 3912 3916 3913 3917 rc = 0; 3918 + 3919 + cifsi->server_eof = i_size_read(inode) - len; 3920 + truncate_setsize(inode, cifsi->server_eof); 3921 + fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof); 3914 3922 out: 3915 3923 free_xid(xid); 3916 3924 return rc;
+1 -1
fs/cifs/transport.c
··· 430 430 * be taken as the remainder of this one. We need to kill the 431 431 * socket so the server throws away the partial SMB 432 432 */ 433 - cifs_mark_tcp_ses_conns_for_reconnect(server, false); 433 + cifs_signal_cifsd_for_reconnect(server, false); 434 434 trace_smb3_partial_send_reconnect(server->CurrentMid, 435 435 server->conn_id, server->hostname); 436 436 }