diff options
| -rw-r--r-- | fs/cifs/cifs_debug.c | 56 | ||||
| -rw-r--r-- | fs/cifs/cifs_spnego.c | 6 | ||||
| -rw-r--r-- | fs/cifs/cifsfs.c | 17 | ||||
| -rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
| -rw-r--r-- | fs/cifs/cifsglob.h | 8 | ||||
| -rw-r--r-- | fs/cifs/cifspdu.h | 3 | ||||
| -rw-r--r-- | fs/cifs/file.c | 436 | ||||
| -rw-r--r-- | fs/cifs/inode.c | 4 | ||||
| -rw-r--r-- | fs/cifs/smb2ops.c | 14 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.c | 6 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.h | 35 | ||||
| -rw-r--r-- | fs/cifs/trace.h | 42 |
12 files changed, 530 insertions, 99 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 3e812428ac8d..ba178b09de0b 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
| @@ -145,6 +145,58 @@ cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface) | |||
| 145 | seq_printf(m, "\t\tIPv6: %pI6\n", &ipv6->sin6_addr); | 145 | seq_printf(m, "\t\tIPv6: %pI6\n", &ipv6->sin6_addr); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static int cifs_debug_files_proc_show(struct seq_file *m, void *v) | ||
| 149 | { | ||
| 150 | struct list_head *stmp, *tmp, *tmp1, *tmp2; | ||
| 151 | struct TCP_Server_Info *server; | ||
| 152 | struct cifs_ses *ses; | ||
| 153 | struct cifs_tcon *tcon; | ||
| 154 | struct cifsFileInfo *cfile; | ||
| 155 | |||
| 156 | seq_puts(m, "# Version:1\n"); | ||
| 157 | seq_puts(m, "# Format:\n"); | ||
| 158 | seq_puts(m, "# <tree id> <persistent fid> <flags> <count> <pid> <uid>"); | ||
| 159 | #ifdef CONFIG_CIFS_DEBUG2 | ||
| 160 | seq_printf(m, " <filename> <mid>\n"); | ||
| 161 | #else | ||
| 162 | seq_printf(m, " <filename>\n"); | ||
| 163 | #endif /* CIFS_DEBUG2 */ | ||
| 164 | spin_lock(&cifs_tcp_ses_lock); | ||
| 165 | list_for_each(stmp, &cifs_tcp_ses_list) { | ||
| 166 | server = list_entry(stmp, struct TCP_Server_Info, | ||
| 167 | tcp_ses_list); | ||
| 168 | list_for_each(tmp, &server->smb_ses_list) { | ||
| 169 | ses = list_entry(tmp, struct cifs_ses, smb_ses_list); | ||
| 170 | list_for_each(tmp1, &ses->tcon_list) { | ||
| 171 | tcon = list_entry(tmp1, struct cifs_tcon, tcon_list); | ||
| 172 | spin_lock(&tcon->open_file_lock); | ||
| 173 | list_for_each(tmp2, &tcon->openFileList) { | ||
| 174 | cfile = list_entry(tmp2, struct cifsFileInfo, | ||
| 175 | tlist); | ||
| 176 | seq_printf(m, | ||
| 177 | "0x%x 0x%llx 0x%x %d %d %d %s", | ||
| 178 | tcon->tid, | ||
| 179 | cfile->fid.persistent_fid, | ||
| 180 | cfile->f_flags, | ||
| 181 | cfile->count, | ||
| 182 | cfile->pid, | ||
| 183 | from_kuid(&init_user_ns, cfile->uid), | ||
| 184 | cfile->dentry->d_name.name); | ||
| 185 | #ifdef CONFIG_CIFS_DEBUG2 | ||
| 186 | seq_printf(m, " 0x%llx\n", cfile->fid.mid); | ||
| 187 | #else | ||
| 188 | seq_printf(m, "\n"); | ||
| 189 | #endif /* CIFS_DEBUG2 */ | ||
| 190 | } | ||
| 191 | spin_unlock(&tcon->open_file_lock); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | } | ||
| 195 | spin_unlock(&cifs_tcp_ses_lock); | ||
| 196 | seq_putc(m, '\n'); | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | |||
| 148 | static int cifs_debug_data_proc_show(struct seq_file *m, void *v) | 200 | static int cifs_debug_data_proc_show(struct seq_file *m, void *v) |
| 149 | { | 201 | { |
| 150 | struct list_head *tmp1, *tmp2, *tmp3; | 202 | struct list_head *tmp1, *tmp2, *tmp3; |
| @@ -565,6 +617,9 @@ cifs_proc_init(void) | |||
| 565 | proc_create_single("DebugData", 0, proc_fs_cifs, | 617 | proc_create_single("DebugData", 0, proc_fs_cifs, |
| 566 | cifs_debug_data_proc_show); | 618 | cifs_debug_data_proc_show); |
| 567 | 619 | ||
| 620 | proc_create_single("open_files", 0400, proc_fs_cifs, | ||
| 621 | cifs_debug_files_proc_show); | ||
| 622 | |||
| 568 | proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops); | 623 | proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_fops); |
| 569 | proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops); | 624 | proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_fops); |
| 570 | proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops); | 625 | proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_fops); |
| @@ -601,6 +656,7 @@ cifs_proc_clean(void) | |||
| 601 | return; | 656 | return; |
| 602 | 657 | ||
| 603 | remove_proc_entry("DebugData", proc_fs_cifs); | 658 | remove_proc_entry("DebugData", proc_fs_cifs); |
| 659 | remove_proc_entry("open_files", proc_fs_cifs); | ||
| 604 | remove_proc_entry("cifsFYI", proc_fs_cifs); | 660 | remove_proc_entry("cifsFYI", proc_fs_cifs); |
| 605 | remove_proc_entry("traceSMB", proc_fs_cifs); | 661 | remove_proc_entry("traceSMB", proc_fs_cifs); |
| 606 | remove_proc_entry("Stats", proc_fs_cifs); | 662 | remove_proc_entry("Stats", proc_fs_cifs); |
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index b611fc2e8984..7f01c6e60791 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c | |||
| @@ -147,8 +147,10 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo) | |||
| 147 | sprintf(dp, ";sec=krb5"); | 147 | sprintf(dp, ";sec=krb5"); |
| 148 | else if (server->sec_mskerberos) | 148 | else if (server->sec_mskerberos) |
| 149 | sprintf(dp, ";sec=mskrb5"); | 149 | sprintf(dp, ";sec=mskrb5"); |
| 150 | else | 150 | else { |
| 151 | goto out; | 151 | cifs_dbg(VFS, "unknown or missing server auth type, use krb5\n"); |
| 152 | sprintf(dp, ";sec=krb5"); | ||
| 153 | } | ||
| 152 | 154 | ||
| 153 | dp = description + strlen(description); | 155 | dp = description + strlen(description); |
| 154 | sprintf(dp, ";uid=0x%x", | 156 | sprintf(dp, ";uid=0x%x", |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index b7ac09e38159..865706edb307 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -999,8 +999,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, | |||
| 999 | struct inode *src_inode = file_inode(src_file); | 999 | struct inode *src_inode = file_inode(src_file); |
| 1000 | struct inode *target_inode = file_inode(dst_file); | 1000 | struct inode *target_inode = file_inode(dst_file); |
| 1001 | struct cifsFileInfo *smb_file_src = src_file->private_data; | 1001 | struct cifsFileInfo *smb_file_src = src_file->private_data; |
| 1002 | struct cifsFileInfo *smb_file_target = dst_file->private_data; | 1002 | struct cifsFileInfo *smb_file_target; |
| 1003 | struct cifs_tcon *target_tcon = tlink_tcon(smb_file_target->tlink); | 1003 | struct cifs_tcon *target_tcon; |
| 1004 | unsigned int xid; | 1004 | unsigned int xid; |
| 1005 | int rc; | 1005 | int rc; |
| 1006 | 1006 | ||
| @@ -1017,6 +1017,9 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, | |||
| 1017 | goto out; | 1017 | goto out; |
| 1018 | } | 1018 | } |
| 1019 | 1019 | ||
| 1020 | smb_file_target = dst_file->private_data; | ||
| 1021 | target_tcon = tlink_tcon(smb_file_target->tlink); | ||
| 1022 | |||
| 1020 | /* | 1023 | /* |
| 1021 | * Note: cifs case is easier than btrfs since server responsible for | 1024 | * Note: cifs case is easier than btrfs since server responsible for |
| 1022 | * checks for proper open modes and file type and if it wants | 1025 | * checks for proper open modes and file type and if it wants |
| @@ -1180,9 +1183,8 @@ const struct file_operations cifs_file_strict_ops = { | |||
| 1180 | }; | 1183 | }; |
| 1181 | 1184 | ||
| 1182 | const struct file_operations cifs_file_direct_ops = { | 1185 | const struct file_operations cifs_file_direct_ops = { |
| 1183 | /* BB reevaluate whether they can be done with directio, no cache */ | 1186 | .read_iter = cifs_direct_readv, |
| 1184 | .read_iter = cifs_user_readv, | 1187 | .write_iter = cifs_direct_writev, |
| 1185 | .write_iter = cifs_user_writev, | ||
| 1186 | .open = cifs_open, | 1188 | .open = cifs_open, |
| 1187 | .release = cifs_close, | 1189 | .release = cifs_close, |
| 1188 | .lock = cifs_lock, | 1190 | .lock = cifs_lock, |
| @@ -1236,9 +1238,8 @@ const struct file_operations cifs_file_strict_nobrl_ops = { | |||
| 1236 | }; | 1238 | }; |
| 1237 | 1239 | ||
| 1238 | const struct file_operations cifs_file_direct_nobrl_ops = { | 1240 | const struct file_operations cifs_file_direct_nobrl_ops = { |
| 1239 | /* BB reevaluate whether they can be done with directio, no cache */ | 1241 | .read_iter = cifs_direct_readv, |
| 1240 | .read_iter = cifs_user_readv, | 1242 | .write_iter = cifs_direct_writev, |
| 1241 | .write_iter = cifs_user_writev, | ||
| 1242 | .open = cifs_open, | 1243 | .open = cifs_open, |
| 1243 | .release = cifs_close, | 1244 | .release = cifs_close, |
| 1244 | .fsync = cifs_fsync, | 1245 | .fsync = cifs_fsync, |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 24e265a51874..4c3b5cfccc49 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
| @@ -101,8 +101,10 @@ extern int cifs_open(struct inode *inode, struct file *file); | |||
| 101 | extern int cifs_close(struct inode *inode, struct file *file); | 101 | extern int cifs_close(struct inode *inode, struct file *file); |
| 102 | extern int cifs_closedir(struct inode *inode, struct file *file); | 102 | extern int cifs_closedir(struct inode *inode, struct file *file); |
| 103 | extern ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to); | 103 | extern ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to); |
| 104 | extern ssize_t cifs_direct_readv(struct kiocb *iocb, struct iov_iter *to); | ||
| 104 | extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); | 105 | extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); |
| 105 | extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); | 106 | extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); |
| 107 | extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); | ||
| 106 | extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); | 108 | extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); |
| 107 | extern int cifs_lock(struct file *, int, struct file_lock *); | 109 | extern int cifs_lock(struct file *, int, struct file_lock *); |
| 108 | extern int cifs_fsync(struct file *, loff_t, loff_t, int); | 110 | extern int cifs_fsync(struct file *, loff_t, loff_t, int); |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index ed1e0fcb69e3..38ab0fca49e1 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
| @@ -1125,6 +1125,9 @@ struct cifs_fid { | |||
| 1125 | __u8 create_guid[16]; | 1125 | __u8 create_guid[16]; |
| 1126 | struct cifs_pending_open *pending_open; | 1126 | struct cifs_pending_open *pending_open; |
| 1127 | unsigned int epoch; | 1127 | unsigned int epoch; |
| 1128 | #ifdef CONFIG_CIFS_DEBUG2 | ||
| 1129 | __u64 mid; | ||
| 1130 | #endif /* CIFS_DEBUG2 */ | ||
| 1128 | bool purge_cache; | 1131 | bool purge_cache; |
| 1129 | }; | 1132 | }; |
| 1130 | 1133 | ||
| @@ -1183,6 +1186,11 @@ struct cifs_aio_ctx { | |||
| 1183 | unsigned int len; | 1186 | unsigned int len; |
| 1184 | unsigned int total_len; | 1187 | unsigned int total_len; |
| 1185 | bool should_dirty; | 1188 | bool should_dirty; |
| 1189 | /* | ||
| 1190 | * Indicates if this aio_ctx is for direct_io, | ||
