Skip to content

Commit 1ab1bd2

Browse files
committed
Merge tag '6.10-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client updates from Steve French: - three important fixes to recent netfs conversion to fix various xfstest failures, and rmmod oops - cleanup patch to fix various GCC-14 warnings * tag '6.10-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb3: fix perf regression with cached writes with netfs conversion cifs: Fix locking in cifs_strict_readv() cifs: Change from mempool_destroy to mempool_exit for request pools smb: smb2pdu.h: Avoid -Wflex-array-member-not-at-end warnings
2 parents 33e02dc + edfc648 commit 1ab1bd2

File tree

9 files changed

+64
-45
lines changed

9 files changed

+64
-45
lines changed

fs/netfs/direct_read.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* The caller must hold any appropriate locks.
2828
*/
29-
static ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter)
29+
ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter)
3030
{
3131
struct netfs_io_request *rreq;
3232
ssize_t ret;
@@ -98,6 +98,7 @@ static ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_
9898
iov_iter_revert(iter, orig_count - iov_iter_count(iter));
9999
return ret;
100100
}
101+
EXPORT_SYMBOL(netfs_unbuffered_read_iter_locked);
101102

102103
/**
103104
* netfs_unbuffered_read_iter - Perform an unbuffered or direct I/O read

fs/smb/client/cifsfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1790,9 +1790,9 @@ static int cifs_init_netfs(void)
17901790

17911791
static void cifs_destroy_netfs(void)
17921792
{
1793-
mempool_destroy(&cifs_io_subrequest_pool);
1793+
mempool_exit(&cifs_io_subrequest_pool);
17941794
kmem_cache_destroy(cifs_io_subrequest_cachep);
1795-
mempool_destroy(&cifs_io_request_pool);
1795+
mempool_exit(&cifs_io_request_pool);
17961796
kmem_cache_destroy(cifs_io_request_cachep);
17971797
}
17981798

fs/smb/client/cifsglob.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,6 +1995,7 @@ require use of the stronger protocol */
19951995
* ->chans_need_reconnect
19961996
* ->chans_in_reconnect
19971997
* cifs_tcon->tc_lock (anything that is not protected by another lock and can change)
1998+
* inode->i_rwsem, taken by fs/netfs/locking.c e.g. should be taken before cifsInodeInfo locks
19981999
* cifsInodeInfo->open_file_lock cifsInodeInfo->openFileList cifs_alloc_inode
19992000
* cifsInodeInfo->writers_lock cifsInodeInfo->writers cifsInodeInfo_alloc
20002001
* cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once

fs/smb/client/file.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,16 +2916,32 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
29162916
* We need to hold the sem to be sure nobody modifies lock list
29172917
* with a brlock that prevents reading.
29182918
*/
2919-
down_read(&cinode->lock_sem);
2920-
if (!cifs_find_lock_conflict(cfile, iocb->ki_pos, iov_iter_count(to),
2921-
tcon->ses->server->vals->shared_lock_type,
2922-
0, NULL, CIFS_READ_OP)) {
2923-
if (iocb->ki_flags & IOCB_DIRECT)
2924-
rc = netfs_unbuffered_read_iter(iocb, to);
2925-
else
2926-
rc = netfs_buffered_read_iter(iocb, to);
2919+
if (iocb->ki_flags & IOCB_DIRECT) {
2920+
rc = netfs_start_io_direct(inode);
2921+
if (rc < 0)
2922+
goto out;
2923+
down_read(&cinode->lock_sem);
2924+
if (!cifs_find_lock_conflict(
2925+
cfile, iocb->ki_pos, iov_iter_count(to),
2926+
tcon->ses->server->vals->shared_lock_type,
2927+
0, NULL, CIFS_READ_OP))
2928+
rc = netfs_unbuffered_read_iter_locked(iocb, to);
2929+
up_read(&cinode->lock_sem);
2930+
netfs_end_io_direct(inode);
2931+
} else {
2932+
rc = netfs_start_io_read(inode);
2933+
if (rc < 0)
2934+
goto out;
2935+
down_read(&cinode->lock_sem);
2936+
if (!cifs_find_lock_conflict(
2937+
cfile, iocb->ki_pos, iov_iter_count(to),
2938+
tcon->ses->server->vals->shared_lock_type,
2939+
0, NULL, CIFS_READ_OP))
2940+
rc = filemap_read(iocb, to, 0);
2941+
up_read(&cinode->lock_sem);
2942+
netfs_end_io_read(inode);
29272943
}
2928-
up_read(&cinode->lock_sem);
2944+
out:
29292945
return rc;
29302946
}
29312947

fs/smb/client/inode.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@
3434
static void cifs_set_netfs_context(struct inode *inode)
3535
{
3636
struct cifsInodeInfo *cifs_i = CIFS_I(inode);
37-
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
3837

3938
netfs_inode_init(&cifs_i->netfs, &cifs_req_ops, true);
40-
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)
41-
__set_bit(NETFS_ICTX_WRITETHROUGH, &cifs_i->netfs.flags);
4239
}
4340

4441
static void cifs_set_ops(struct inode *inode)

fs/smb/client/smb2pdu.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ struct durable_context_v2 {
145145
} __packed;
146146

147147
struct create_durable_v2 {
148-
struct create_context ccontext;
148+
struct create_context_hdr ccontext;
149149
__u8 Name[8];
150150
struct durable_context_v2 dcontext;
151151
} __packed;
@@ -167,28 +167,28 @@ struct durable_reconnect_context_v2_rsp {
167167
} __packed;
168168

169169
struct create_durable_handle_reconnect_v2 {
170-
struct create_context ccontext;
170+
struct create_context_hdr ccontext;
171171
__u8 Name[8];
172172
struct durable_reconnect_context_v2 dcontext;
173173
__u8 Pad[4];
174174
} __packed;
175175

176176
/* See MS-SMB2 2.2.13.2.5 */
177177
struct crt_twarp_ctxt {
178-
struct create_context ccontext;
178+
struct create_context_hdr ccontext;
179179
__u8 Name[8];
180180
__le64 Timestamp;
181181

182182
} __packed;
183183

184184
/* See MS-SMB2 2.2.13.2.9 */
185185
struct crt_query_id_ctxt {
186-
struct create_context ccontext;
186+
struct create_context_hdr ccontext;
187187
__u8 Name[8];
188188
} __packed;
189189

190190
struct crt_sd_ctxt {
191-
struct create_context ccontext;
191+
struct create_context_hdr ccontext;
192192
__u8 Name[8];
193193
struct smb3_sd sd;
194194
} __packed;
@@ -415,7 +415,7 @@ struct smb2_posix_info_parsed {
415415
};
416416

417417
struct smb2_create_ea_ctx {
418-
struct create_context ctx;
418+
struct create_context_hdr ctx;
419419
__u8 name[8];
420420
struct smb2_file_full_ea_info ea;
421421
} __packed;

fs/smb/common/smb2pdu.h

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,12 +1171,15 @@ struct smb2_server_client_notification {
11711171
#define SMB2_CREATE_FLAG_REPARSEPOINT 0x01
11721172

11731173
struct create_context {
1174-
__le32 Next;
1175-
__le16 NameOffset;
1176-
__le16 NameLength;
1177-
__le16 Reserved;
1178-
__le16 DataOffset;
1179-
__le32 DataLength;
1174+
/* New members must be added within the struct_group() macro below. */
1175+
__struct_group(create_context_hdr, hdr, __packed,
1176+
__le32 Next;
1177+
__le16 NameOffset;
1178+
__le16 NameLength;
1179+
__le16 Reserved;
1180+
__le16 DataOffset;
1181+
__le32 DataLength;
1182+
);
11801183
__u8 Buffer[];
11811184
} __packed;
11821185

@@ -1222,15 +1225,15 @@ struct smb2_create_rsp {
12221225
} __packed;
12231226

12241227
struct create_posix {
1225-
struct create_context ccontext;
1228+
struct create_context_hdr ccontext;
12261229
__u8 Name[16];
12271230
__le32 Mode;
12281231
__u32 Reserved;
12291232
} __packed;
12301233

12311234
/* See MS-SMB2 2.2.13.2.3 and MS-SMB2 2.2.13.2.4 */
12321235
struct create_durable {
1233-
struct create_context ccontext;
1236+
struct create_context_hdr ccontext;
12341237
__u8 Name[8];
12351238
union {
12361239
__u8 Reserved[16];
@@ -1243,14 +1246,14 @@ struct create_durable {
12431246

12441247
/* See MS-SMB2 2.2.13.2.5 */
12451248
struct create_mxac_req {
1246-
struct create_context ccontext;
1249+
struct create_context_hdr ccontext;
12471250
__u8 Name[8];
12481251
__le64 Timestamp;
12491252
} __packed;
12501253

12511254
/* See MS-SMB2 2.2.14.2.5 */
12521255
struct create_mxac_rsp {
1253-
struct create_context ccontext;
1256+
struct create_context_hdr ccontext;
12541257
__u8 Name[8];
12551258
__le32 QueryStatus;
12561259
__le32 MaximalAccess;
@@ -1286,21 +1289,21 @@ struct lease_context_v2 {
12861289
} __packed;
12871290

12881291
struct create_lease {
1289-
struct create_context ccontext;
1292+
struct create_context_hdr ccontext;
12901293
__u8 Name[8];
12911294
struct lease_context lcontext;
12921295
} __packed;
12931296

12941297
struct create_lease_v2 {
1295-
struct create_context ccontext;
1298+
struct create_context_hdr ccontext;
12961299
__u8 Name[8];
12971300
struct lease_context_v2 lcontext;
12981301
__u8 Pad[4];
12991302
} __packed;
13001303

13011304
/* See MS-SMB2 2.2.14.2.9 */
13021305
struct create_disk_id_rsp {
1303-
struct create_context ccontext;
1306+
struct create_context_hdr ccontext;
13041307
__u8 Name[8];
13051308
__le64 DiskFileId;
13061309
__le64 VolumeId;
@@ -1309,7 +1312,7 @@ struct create_disk_id_rsp {
13091312

13101313
/* See MS-SMB2 2.2.13.2.13 */
13111314
struct create_app_inst_id {
1312-
struct create_context ccontext;
1315+
struct create_context_hdr ccontext;
13131316
__u8 Name[16];
13141317
__le32 StructureSize; /* Must be 20 */
13151318
__u16 Reserved;
@@ -1318,7 +1321,7 @@ struct create_app_inst_id {
13181321

13191322
/* See MS-SMB2 2.2.13.2.15 */
13201323
struct create_app_inst_id_vers {
1321-
struct create_context ccontext;
1324+
struct create_context_hdr ccontext;
13221325
__u8 Name[16];
13231326
__le32 StructureSize; /* Must be 24 */
13241327
__u16 Reserved;

fs/smb/server/smb2pdu.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct preauth_integrity_info {
6464
#define SMB2_SESSION_TIMEOUT (10 * HZ)
6565

6666
struct create_durable_req_v2 {
67-
struct create_context ccontext;
67+
struct create_context_hdr ccontext;
6868
__u8 Name[8];
6969
__le32 Timeout;
7070
__le32 Flags;
@@ -73,7 +73,7 @@ struct create_durable_req_v2 {
7373
} __packed;
7474

7575
struct create_durable_reconn_req {
76-
struct create_context ccontext;
76+
struct create_context_hdr ccontext;
7777
__u8 Name[8];
7878
union {
7979
__u8 Reserved[16];
@@ -85,7 +85,7 @@ struct create_durable_reconn_req {
8585
} __packed;
8686

8787
struct create_durable_reconn_v2_req {
88-
struct create_context ccontext;
88+
struct create_context_hdr ccontext;
8989
__u8 Name[8];
9090
struct {
9191
__u64 PersistentFileId;
@@ -96,13 +96,13 @@ struct create_durable_reconn_v2_req {
9696
} __packed;
9797

9898
struct create_alloc_size_req {
99-
struct create_context ccontext;
99+
struct create_context_hdr ccontext;
100100
__u8 Name[8];
101101
__le64 AllocationSize;
102102
} __packed;
103103

104104
struct create_durable_rsp {
105-
struct create_context ccontext;
105+
struct create_context_hdr ccontext;
106106
__u8 Name[8];
107107
union {
108108
__u8 Reserved[8];
@@ -114,15 +114,15 @@ struct create_durable_rsp {
114114
/* Flags */
115115
#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
116116
struct create_durable_v2_rsp {
117-
struct create_context ccontext;
117+
struct create_context_hdr ccontext;
118118
__u8 Name[8];
119119
__le32 Timeout;
120120
__le32 Flags;
121121
} __packed;
122122

123123
/* equivalent of the contents of SMB3.1.1 POSIX open context response */
124124
struct create_posix_rsp {
125-
struct create_context ccontext;
125+
struct create_context_hdr ccontext;
126126
__u8 Name[16];
127127
__le32 nlink;
128128
__le32 reparse_tag;
@@ -381,13 +381,13 @@ struct smb2_ea_info {
381381
} __packed; /* level 15 Query */
382382

383383
struct create_ea_buf_req {
384-
struct create_context ccontext;
384+
struct create_context_hdr ccontext;
385385
__u8 Name[8];
386386
struct smb2_ea_info ea;
387387
} __packed;
388388

389389
struct create_sd_buf_req {
390-
struct create_context ccontext;
390+
struct create_context_hdr ccontext;
391391
__u8 Name[8];
392392
struct smb_ntsd ntsd;
393393
} __packed;

include/linux/netfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ struct netfs_cache_ops {
389389
};
390390

391391
/* High-level read API. */
392+
ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter);
392393
ssize_t netfs_unbuffered_read_iter(struct kiocb *iocb, struct iov_iter *iter);
393394
ssize_t netfs_buffered_read_iter(struct kiocb *iocb, struct iov_iter *iter);
394395
ssize_t netfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter);

0 commit comments

Comments
 (0)