Skip to content

Commit 645c248

Browse files
committed
Merge tag '5.7-rc-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs updates from Steve French: "First part of cifs/smb3 changes for merge window (others are still being tested). Various RDMA (smbdirect) fixes, addition of SMB3.1.1 POSIX support in readdir, 3 fixes for stable, and a fix for flock. Summary: New feature: - SMB3.1.1 POSIX support in readdir Fixes: - various RDMA (smbdirect) fixes - fix for flock - fallocate fix - some improved mount warnings - two timestamp related fixes - reconnect fix - three fixes for stable" * tag '5.7-rc-smb3-fixes-part1' of git://git.samba.org/sfrench/cifs-2.6: (28 commits) cifs: update internal module version number cifs: Allocate encryption header through kmalloc cifs: smbd: Check and extend sender credits in interrupt context cifs: smbd: Calculate the correct maximum packet size for segmented SMBDirect send/receive smb3: use SMB2_SIGNATURE_SIZE define CIFS: Fix bug which the return value by asynchronous read is error CIFS: check new file size when extending file by fallocate SMB3: Minor cleanup of protocol definitions SMB3: Additional compression structures SMB3: Add new compression flags cifs: smb2pdu.h: Replace zero-length array with flexible-array member cifs: clear PF_MEMALLOC before exiting demultiplex thread cifs: cifspdu.h: Replace zero-length array with flexible-array member CIFS: Warn less noisily on default mount fs/cifs: fix gcc warning in sid_to_id cifs: allow unlock flock and OFD lock across fork cifs: do d_move in rename cifs: add SMB2_open() arg to return POSIX data cifs: plumb smb2 POSIX dir enumeration cifs: add smb2 POSIX info level ...
2 parents 018d21f + f460c50 commit 645c248

23 files changed

+673
-232
lines changed

fs/cifs/cifsacl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static int
342342
sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
343343
struct cifs_fattr *fattr, uint sidtype)
344344
{
345-
int rc;
345+
int rc = 0;
346346
struct key *sidkey;
347347
char *sidstr;
348348
const struct cred *saved_cred;
@@ -450,11 +450,12 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
450450
* fails then we just fall back to using the mnt_uid/mnt_gid.
451451
*/
452452
got_valid_id:
453+
rc = 0;
453454
if (sidtype == SIDOWNER)
454455
fattr->cf_uid = fuid;
455456
else
456457
fattr->cf_gid = fgid;
457-
return 0;
458+
return rc;
458459
}
459460

460461
int

fs/cifs/cifsfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ struct file_system_type cifs_fs_type = {
10181018
.name = "cifs",
10191019
.mount = cifs_do_mount,
10201020
.kill_sb = cifs_kill_sb,
1021-
/* .fs_flags */
1021+
.fs_flags = FS_RENAME_DOES_D_MOVE,
10221022
};
10231023
MODULE_ALIAS_FS("cifs");
10241024

@@ -1027,7 +1027,7 @@ static struct file_system_type smb3_fs_type = {
10271027
.name = "smb3",
10281028
.mount = smb3_do_mount,
10291029
.kill_sb = cifs_kill_sb,
1030-
/* .fs_flags */
1030+
.fs_flags = FS_RENAME_DOES_D_MOVE,
10311031
};
10321032
MODULE_ALIAS_FS("smb3");
10331033
MODULE_ALIAS("smb3");

fs/cifs/cifsfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,5 @@ extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
156156
extern const struct export_operations cifs_export_ops;
157157
#endif /* CONFIG_CIFS_NFSD_EXPORT */
158158

159-
#define CIFS_VERSION "2.25"
159+
#define CIFS_VERSION "2.26"
160160
#endif /* _CIFSFS_H */

fs/cifs/cifspdu.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ typedef struct smb_com_writex_req {
10211021
__le16 ByteCount;
10221022
__u8 Pad; /* BB check for whether padded to DWORD
10231023
boundary and optimum performance here */
1024-
char Data[0];
1024+
char Data[];
10251025
} __attribute__((packed)) WRITEX_REQ;
10261026

10271027
typedef struct smb_com_write_req {
@@ -1041,7 +1041,7 @@ typedef struct smb_com_write_req {
10411041
__le16 ByteCount;
10421042
__u8 Pad; /* BB check for whether padded to DWORD
10431043
boundary and optimum performance here */
1044-
char Data[0];
1044+
char Data[];
10451045
} __attribute__((packed)) WRITE_REQ;
10461046

10471047
typedef struct smb_com_write_rsp {
@@ -1306,7 +1306,7 @@ typedef struct smb_com_ntransact_req {
13061306
/* SetupCount words follow then */
13071307
__le16 ByteCount;
13081308
__u8 Pad[3];
1309-
__u8 Parms[0];
1309+
__u8 Parms[];
13101310
} __attribute__((packed)) NTRANSACT_REQ;
13111311

13121312
typedef struct smb_com_ntransact_rsp {
@@ -1523,7 +1523,7 @@ struct file_notify_information {
15231523
__le32 NextEntryOffset;
15241524
__le32 Action;
15251525
__le32 FileNameLength;
1526-
__u8 FileName[0];
1526+
__u8 FileName[];
15271527
} __attribute__((packed));
15281528

15291529
/* For IO_REPARSE_TAG_SYMLINK */
@@ -1536,7 +1536,7 @@ struct reparse_symlink_data {
15361536
__le16 PrintNameOffset;
15371537
__le16 PrintNameLength;
15381538
__le32 Flags;
1539-
char PathBuffer[0];
1539+
char PathBuffer[];
15401540
} __attribute__((packed));
15411541

15421542
/* Flag above */
@@ -1553,7 +1553,7 @@ struct reparse_posix_data {
15531553
__le16 ReparseDataLength;
15541554
__u16 Reserved;
15551555
__le64 InodeType; /* LNK, FIFO, CHR etc. */
1556-
char PathBuffer[0];
1556+
char PathBuffer[];
15571557
} __attribute__((packed));
15581558

15591559
struct cifs_quota_data {
@@ -1691,6 +1691,7 @@ struct smb_t2_rsp {
16911691
#define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105
16921692
#define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106
16931693
#define SMB_FIND_FILE_UNIX 0x202
1694+
#define SMB_FIND_FILE_POSIX_INFO 0x064
16941695

16951696
typedef struct smb_com_transaction2_qpi_req {
16961697
struct smb_hdr hdr; /* wct = 14+ */
@@ -1761,7 +1762,7 @@ struct set_file_rename {
17611762
__le32 overwrite; /* 1 = overwrite dest */
17621763
__u32 root_fid; /* zero */
17631764
__le32 target_name_len;
1764-
char target_name[0]; /* Must be unicode */
1765+
char target_name[]; /* Must be unicode */
17651766
} __attribute__((packed));
17661767

17671768
struct smb_com_transaction2_sfi_req {
@@ -2450,7 +2451,7 @@ struct cifs_posix_acl { /* access conrol list (ACL) */
24502451
__le16 version;
24512452
__le16 access_entry_count; /* access ACL - count of entries */
24522453
__le16 default_entry_count; /* default ACL - count of entries */
2453-
struct cifs_posix_ace ace_array[0];
2454+
struct cifs_posix_ace ace_array[];
24542455
/* followed by
24552456
struct cifs_posix_ace default_ace_arraay[] */
24562457
} __attribute__((packed)); /* level 0x204 */
@@ -2756,7 +2757,7 @@ typedef struct file_xattr_info {
27562757
/* BB do we need another field for flags? BB */
27572758
__u32 xattr_name_len;
27582759
__u32 xattr_value_len;
2759-
char xattr_name[0];
2760+
char xattr_name[];
27602761
/* followed by xattr_value[xattr_value_len], no pad */
27612762
} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute info
27622763
level 0x205 */

fs/cifs/cifsproto.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,11 @@ int smb2_parse_query_directory(struct cifs_tcon *tcon, struct kvec *rsp_iov,
602602
int resp_buftype,
603603
struct cifs_search_info *srch_inf);
604604

605+
struct super_block *cifs_get_tcp_super(struct TCP_Server_Info *server);
606+
void cifs_put_tcp_super(struct super_block *sb);
607+
int update_super_prepath(struct cifs_tcon *tcon, const char *prefix,
608+
size_t prefix_len);
609+
605610
#ifdef CONFIG_CIFS_DFS_UPCALL
606611
static inline int get_dfs_path(const unsigned int xid, struct cifs_ses *ses,
607612
const char *old_path,

fs/cifs/cifssmb.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,18 @@ static int __cifs_reconnect_tcon(const struct nls_table *nlsc,
162162

163163
for (it = dfs_cache_get_tgt_iterator(&tl); it;
164164
it = dfs_cache_get_next_tgt(&tl, it)) {
165-
const char *tgt = dfs_cache_get_tgt_name(it);
165+
const char *share, *prefix;
166+
size_t share_len, prefix_len;
166167

167-
extract_unc_hostname(tgt, &dfs_host, &dfs_host_len);
168+
rc = dfs_cache_get_tgt_share(it, &share, &share_len, &prefix,
169+
&prefix_len);
170+
if (rc) {
171+
cifs_dbg(VFS, "%s: failed to parse target share %d\n",
172+
__func__, rc);
173+
continue;
174+
}
175+
176+
extract_unc_hostname(share, &dfs_host, &dfs_host_len);
168177

169178
if (dfs_host_len != tcp_host_len
170179
|| strncasecmp(dfs_host, tcp_host, dfs_host_len) != 0) {
@@ -175,11 +184,13 @@ static int __cifs_reconnect_tcon(const struct nls_table *nlsc,
175184
continue;
176185
}
177186

178-
scnprintf(tree, MAX_TREE_SIZE, "\\%s", tgt);
187+
scnprintf(tree, MAX_TREE_SIZE, "\\%.*s", (int)share_len, share);
179188

180189
rc = CIFSTCon(0, tcon->ses, tree, tcon, nlsc);
181-
if (!rc)
190+
if (!rc) {
191+
rc = update_super_prepath(tcon, prefix, prefix_len);
182192
break;
193+
}
183194
if (rc == -EREMOTE)
184195
break;
185196
}
@@ -320,7 +331,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
320331
atomic_inc(&tconInfoReconnectCount);
321332

322333
/* tell server Unix caps we support */
323-
if (ses->capabilities & CAP_UNIX)
334+
if (cap_unix(ses))
324335
reset_cifs_unix_caps(0, tcon, NULL, NULL);
325336

326337
/*
@@ -1591,7 +1602,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
15911602
if (server->ops->is_session_expired &&
15921603
server->ops->is_session_expired(buf)) {
15931604
cifs_reconnect(server);
1594-
wake_up(&server->response_q);
15951605
return -1;
15961606
}
15971607

0 commit comments

Comments
 (0)