aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/file.c18
-rw-r--r--fs/cifs/smb2pdu.c5
3 files changed, 25 insertions, 0 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 4ead72a001f9..ced0e42ce460 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -193,6 +193,8 @@ extern struct smb_vol *cifs_get_volume_info(char *mount_data,
193extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *); 193extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
194extern void cifs_umount(struct cifs_sb_info *); 194extern void cifs_umount(struct cifs_sb_info *);
195extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon); 195extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
196extern void cifs_reopen_persistent_handles(struct cifs_tcon *tcon);
197
196extern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset, 198extern bool cifs_find_lock_conflict(struct cifsFileInfo *cfile, __u64 offset,
197 __u64 length, __u8 type, 199 __u64 length, __u8 type,
198 struct cifsLockInfo **conf_lock, 200 struct cifsLockInfo **conf_lock,
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ee5ceae22411..8f27c8a74384 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -760,6 +760,24 @@ int cifs_close(struct inode *inode, struct file *file)
760 return 0; 760 return 0;
761} 761}
762 762
763void
764cifs_reopen_persistent_handles(struct cifs_tcon *tcon)
765{
766 struct cifsFileInfo *open_file = NULL;
767 struct list_head *tmp;
768 struct list_head *tmp1;
769
770 /* list all files open on tree connection, reopen resilient handles */
771 spin_lock(&tcon->open_file_lock);
772 list_for_each_safe(tmp, tmp1, &tcon->openFileList) {
773 open_file = list_entry(tmp, struct cifsFileInfo, tlist);
774 spin_unlock(&tcon->open_file_lock);
775 cifs_reopen_file(open_file, false /* do not flush */);
776 spin_lock(&tcon->open_file_lock);
777 }
778 spin_unlock(&tcon->open_file_lock);
779}
780
763int cifs_closedir(struct inode *inode, struct file *file) 781int cifs_closedir(struct inode *inode, struct file *file)
764{ 782{
765 int rc = 0; 783 int rc = 0;
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 3eec96ca87d9..4d944c4c55a8 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -250,8 +250,13 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
250 } 250 }
251 251
252 cifs_mark_open_files_invalid(tcon); 252 cifs_mark_open_files_invalid(tcon);
253
253 rc = SMB2_tcon(0, tcon->ses, tcon->treeName, tcon, nls_codepage); 254 rc = SMB2_tcon(0, tcon->ses, tcon->treeName, tcon, nls_codepage);
254 mutex_unlock(&tcon->ses->session_mutex); 255 mutex_unlock(&tcon->ses->session_mutex);
256
257 if (tcon->use_persistent)
258 cifs_reopen_persistent_handles(tcon);
259
255 cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc); 260 cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc);
256 if (rc) 261 if (rc)
257 goto out; 262 goto out;