diff options
| -rw-r--r-- | fs/cifs/cifsglob.h | 14 | ||||
| -rw-r--r-- | fs/cifs/connect.c | 6 | ||||
| -rw-r--r-- | fs/cifs/dir.c | 3 | ||||
| -rw-r--r-- | fs/cifs/file.c | 33 | ||||
| -rw-r--r-- | fs/cifs/inode.c | 26 | ||||
| -rw-r--r-- | fs/cifs/link.c | 6 | ||||
| -rw-r--r-- | fs/cifs/readdir.c | 16 | ||||
| -rw-r--r-- | fs/cifs/smb1ops.c | 3 | ||||
| -rw-r--r-- | fs/cifs/smb2ops.c | 3 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.c | 2 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.h | 3 |
11 files changed, 66 insertions, 49 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 12b1176b87b0..bcdf4d4420f1 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
| @@ -258,6 +258,9 @@ struct smb_version_values { | |||
| 258 | size_t max_header_size; | 258 | size_t max_header_size; |
| 259 | size_t read_rsp_size; | 259 | size_t read_rsp_size; |
| 260 | __le16 lock_cmd; | 260 | __le16 lock_cmd; |
| 261 | unsigned int cap_unix; | ||
| 262 | unsigned int cap_nt_find; | ||
| 263 | unsigned int cap_large_files; | ||
| 261 | }; | 264 | }; |
| 262 | 265 | ||
| 263 | #define HEADER_SIZE(server) (server->vals->header_size) | 266 | #define HEADER_SIZE(server) (server->vals->header_size) |
| @@ -408,7 +411,7 @@ struct TCP_Server_Info { | |||
| 408 | unsigned int max_vcs; /* maximum number of smb sessions, at least | 411 | unsigned int max_vcs; /* maximum number of smb sessions, at least |
| 409 | those that can be specified uniquely with | 412 | those that can be specified uniquely with |
| 410 | vcnumbers */ | 413 | vcnumbers */ |
| 411 | int capabilities; /* allow selective disabling of caps by smb sess */ | 414 | unsigned int capabilities; /* selective disabling of caps by smb sess */ |
| 412 | int timeAdj; /* Adjust for difference in server time zone in sec */ | 415 | int timeAdj; /* Adjust for difference in server time zone in sec */ |
| 413 | __u64 CurrentMid; /* multiplex id - rotating counter */ | 416 | __u64 CurrentMid; /* multiplex id - rotating counter */ |
| 414 | char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ | 417 | char cryptkey[CIFS_CRYPTO_KEY_SIZE]; /* used by ntlm, ntlmv2 etc */ |
| @@ -532,7 +535,7 @@ struct cifs_ses { | |||
| 532 | __u64 Suid; /* remote smb uid */ | 535 | __u64 Suid; /* remote smb uid */ |
| 533 | uid_t linux_uid; /* overriding owner of files on the mount */ | 536 | uid_t linux_uid; /* overriding owner of files on the mount */ |
| 534 | uid_t cred_uid; /* owner of credentials */ | 537 | uid_t cred_uid; /* owner of credentials */ |
| 535 | int capabilities; | 538 | unsigned int capabilities; |
| 536 | char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for | 539 | char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for |
| 537 | TCP names - will ipv6 and sctp addresses fit? */ | 540 | TCP names - will ipv6 and sctp addresses fit? */ |
| 538 | char *user_name; /* must not be null except during init of sess | 541 | char *user_name; /* must not be null except during init of sess |
| @@ -554,6 +557,13 @@ struct cifs_ses { | |||
| 554 | which do not negotiate NTLM or POSIX dialects, but instead | 557 | which do not negotiate NTLM or POSIX dialects, but instead |
| 555 | negotiate one of the older LANMAN dialects */ | 558 | negotiate one of the older LANMAN dialects */ |
| 556 | #define CIFS_SES_LANMAN 8 | 559 | #define CIFS_SES_LANMAN 8 |
| 560 | |||
| 561 | static inline bool | ||
| 562 | cap_unix(struct cifs_ses *ses) | ||
| 563 | { | ||
| 564 | return ses->server->vals->cap_unix & ses->capabilities; | ||
| 565 | } | ||
| 566 | |||
| 557 | /* | 567 | /* |
| 558 | * there is one of these for each connection to a resource on a particular | 568 | * there is one of these for each connection to a resource on a particular |
| 559 | * session | 569 | * session |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5ab173fd6339..6df6fa14cba8 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -3634,7 +3634,7 @@ try_mount_again: | |||
| 3634 | } | 3634 | } |
| 3635 | 3635 | ||
| 3636 | /* tell server which Unix caps we support */ | 3636 | /* tell server which Unix caps we support */ |
| 3637 | if (tcon->ses->capabilities & CAP_UNIX) { | 3637 | if (cap_unix(tcon->ses)) { |
| 3638 | /* reset of caps checks mount to see if unix extensions | 3638 | /* reset of caps checks mount to see if unix extensions |
| 3639 | disabled for just this mount */ | 3639 | disabled for just this mount */ |
| 3640 | reset_cifs_unix_caps(xid, tcon, cifs_sb, volume_info); | 3640 | reset_cifs_unix_caps(xid, tcon, cifs_sb, volume_info); |
| @@ -3993,7 +3993,7 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, | |||
| 3993 | ses->flags = 0; | 3993 | ses->flags = 0; |
| 3994 | ses->capabilities = server->capabilities; | 3994 | ses->capabilities = server->capabilities; |
| 3995 | if (linuxExtEnabled == 0) | 3995 | if (linuxExtEnabled == 0) |
| 3996 | ses->capabilities &= (~CAP_UNIX); | 3996 | ses->capabilities &= (~server->vals->cap_unix); |
| 3997 | 3997 | ||
| 3998 | cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", | 3998 | cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", |
| 3999 | server->sec_mode, server->capabilities, server->timeAdj); | 3999 | server->sec_mode, server->capabilities, server->timeAdj); |
| @@ -4100,7 +4100,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid) | |||
| 4100 | goto out; | 4100 | goto out; |
| 4101 | } | 4101 | } |
| 4102 | 4102 | ||
| 4103 | if (ses->capabilities & CAP_UNIX) | 4103 | if (cap_unix(ses)) |
| 4104 | reset_cifs_unix_caps(0, tcon, NULL, vol_info); | 4104 | reset_cifs_unix_caps(0, tcon, NULL, vol_info); |
| 4105 | out: | 4105 | out: |
| 4106 | kfree(vol_info->username); | 4106 | kfree(vol_info->username); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 2caba0b54acb..cbe709ad6663 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -182,8 +182,7 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, | |||
| 182 | goto out; | 182 | goto out; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) && | 185 | if (tcon->unix_ext && cap_unix(tcon->ses) && !tcon->broken_posix_open && |
| 186 | !tcon->broken_posix_open && | ||
| 187 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | 186 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & |
| 188 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { | 187 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { |
| 189 | rc = cifs_posix_open(full_path, &newinode, | 188 | rc = cifs_posix_open(full_path, &newinode, |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 93b3b1358409..07e9d41cade7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -385,9 +385,8 @@ int cifs_open(struct inode *inode, struct file *file) | |||
| 385 | oplock = 0; | 385 | oplock = 0; |
| 386 | 386 | ||
| 387 | if (!tcon->broken_posix_open && tcon->unix_ext && | 387 | if (!tcon->broken_posix_open && tcon->unix_ext && |
| 388 | (tcon->ses->capabilities & CAP_UNIX) && | 388 | cap_unix(tcon->ses) && (CIFS_UNIX_POSIX_PATH_OPS_CAP & |
| 389 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | 389 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { |
| 390 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { | ||
| 391 | /* can not refresh inode info since size could be stale */ | 390 | /* can not refresh inode info since size could be stale */ |
| 392 | rc = cifs_posix_open(full_path, &inode, inode->i_sb, | 391 | rc = cifs_posix_open(full_path, &inode, inode->i_sb, |
| 393 | cifs_sb->mnt_file_mode /* ignored */, | 392 | cifs_sb->mnt_file_mode /* ignored */, |
| @@ -509,10 +508,9 @@ static int cifs_reopen_file(struct cifsFileInfo *pCifsFile, bool can_flush) | |||
| 509 | else | 508 | else |
| 510 | oplock = 0; | 509 | oplock = 0; |
| 511 | 510 | ||
| 512 | if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) && | 511 | if (tcon->unix_ext && cap_unix(tcon->ses) && |
| 513 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & | 512 | (CIFS_UNIX_POSIX_PATH_OPS_CAP & |
| 514 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { | 513 | le64_to_cpu(tcon->fsUnixInfo.Capability))) { |
| 515 | |||
| 516 | /* | 514 | /* |
| 517 | * O_CREAT, O_EXCL and O_TRUNC already had their effect on the | 515 | * O_CREAT, O_EXCL and O_TRUNC already had their effect on the |
| 518 | * original open. Must mask them off for a reopen. | 516 | * original open. Must mask them off for a reopen. |
| @@ -1071,7 +1069,7 @@ cifs_push_locks(struct cifsFileInfo *cfile) | |||
| 1071 | struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); | 1069 | struct cifs_sb_info *cifs_sb = CIFS_SB(cfile->dentry->d_sb); |
| 1072 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 1070 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
| 1073 | 1071 | ||
| 1074 | if ((tcon->ses->capabilities & CAP_UNIX) && | 1072 | if (cap_unix(tcon->ses) && |
| 1075 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && | 1073 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && |
| 1076 | ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) | 1074 | ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) |
| 1077 | return cifs_push_posix_locks(cfile); | 1075 | return cifs_push_posix_locks(cfile); |
| @@ -1419,7 +1417,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock) | |||
| 1419 | netfid = cfile->netfid; | 1417 | netfid = cfile->netfid; |
| 1420 | cinode = CIFS_I(file->f_path.dentry->d_inode); | 1418 | cinode = CIFS_I(file->f_path.dentry->d_inode); |
| 1421 | 1419 | ||
| 1422 | if ((tcon->ses->capabilities & CAP_UNIX) && | 1420 | if (cap_unix(tcon->ses) && |
| 1423 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && | 1421 | (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) && |
| 1424 | ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) | 1422 | ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) |
| 1425 | posix_lck = true; | 1423 | posix_lck = true; |
| @@ -2745,7 +2743,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
| 2745 | unsigned int current_read_size; | 2743 | unsigned int current_read_size; |
| 2746 | unsigned int rsize; | 2744 | unsigned int rsize; |
| 2747 | struct cifs_sb_info *cifs_sb; | 2745 | struct cifs_sb_info *cifs_sb; |
| 2748 | struct cifs_tcon *pTcon; | 2746 | struct cifs_tcon *tcon; |
| 2749 | unsigned int xid; | 2747 | unsigned int xid; |
| 2750 | char *current_offset; | 2748 | char *current_offset; |
| 2751 | struct cifsFileInfo *open_file; | 2749 | struct cifsFileInfo *open_file; |
| @@ -2765,7 +2763,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
| 2765 | return rc; | 2763 | return rc; |
| 2766 | } | 2764 | } |
| 2767 | open_file = file->private_data; | 2765 | open_file = file->private_data; |
| 2768 | pTcon = tlink_tcon(open_file->tlink); | 2766 | tcon = tlink_tcon(open_file->tlink); |
| 2769 | 2767 | ||
| 2770 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) | 2768 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) |
| 2771 | pid = open_file->pid; | ||
