Commit 1ab1bd2f authored by Linus Torvalds's avatar Linus Torvalds

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
parents 33e02dc6 edfc6481
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* The caller must hold any appropriate locks. * The caller must hold any appropriate locks.
*/ */
static ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter) ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter)
{ {
struct netfs_io_request *rreq; struct netfs_io_request *rreq;
ssize_t ret; ssize_t ret;
...@@ -98,6 +98,7 @@ static ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_ ...@@ -98,6 +98,7 @@ static ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_
iov_iter_revert(iter, orig_count - iov_iter_count(iter)); iov_iter_revert(iter, orig_count - iov_iter_count(iter));
return ret; return ret;
} }
EXPORT_SYMBOL(netfs_unbuffered_read_iter_locked);
/** /**
* netfs_unbuffered_read_iter - Perform an unbuffered or direct I/O read * netfs_unbuffered_read_iter - Perform an unbuffered or direct I/O read
......
...@@ -1790,9 +1790,9 @@ static int cifs_init_netfs(void) ...@@ -1790,9 +1790,9 @@ static int cifs_init_netfs(void)
static void cifs_destroy_netfs(void) static void cifs_destroy_netfs(void)
{ {
mempool_destroy(&cifs_io_subrequest_pool); mempool_exit(&cifs_io_subrequest_pool);
kmem_cache_destroy(cifs_io_subrequest_cachep); kmem_cache_destroy(cifs_io_subrequest_cachep);
mempool_destroy(&cifs_io_request_pool); mempool_exit(&cifs_io_request_pool);
kmem_cache_destroy(cifs_io_request_cachep); kmem_cache_destroy(cifs_io_request_cachep);
} }
......
...@@ -1995,6 +1995,7 @@ require use of the stronger protocol */ ...@@ -1995,6 +1995,7 @@ require use of the stronger protocol */
* ->chans_need_reconnect * ->chans_need_reconnect
* ->chans_in_reconnect * ->chans_in_reconnect
* cifs_tcon->tc_lock (anything that is not protected by another lock and can change) * cifs_tcon->tc_lock (anything that is not protected by another lock and can change)
* inode->i_rwsem, taken by fs/netfs/locking.c e.g. should be taken before cifsInodeInfo locks
* cifsInodeInfo->open_file_lock cifsInodeInfo->openFileList cifs_alloc_inode * cifsInodeInfo->open_file_lock cifsInodeInfo->openFileList cifs_alloc_inode
* cifsInodeInfo->writers_lock cifsInodeInfo->writers cifsInodeInfo_alloc * cifsInodeInfo->writers_lock cifsInodeInfo->writers cifsInodeInfo_alloc
* cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once * cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once
......
...@@ -2916,16 +2916,32 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to) ...@@ -2916,16 +2916,32 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
* We need to hold the sem to be sure nobody modifies lock list * We need to hold the sem to be sure nobody modifies lock list
* with a brlock that prevents reading. * with a brlock that prevents reading.
*/ */
down_read(&cinode->lock_sem); if (iocb->ki_flags & IOCB_DIRECT) {
if (!cifs_find_lock_conflict(cfile, iocb->ki_pos, iov_iter_count(to), rc = netfs_start_io_direct(inode);
tcon->ses->server->vals->shared_lock_type, if (rc < 0)
0, NULL, CIFS_READ_OP)) { goto out;
if (iocb->ki_flags & IOCB_DIRECT) down_read(&cinode->lock_sem);
rc = netfs_unbuffered_read_iter(iocb, to); if (!cifs_find_lock_conflict(
else cfile, iocb->ki_pos, iov_iter_count(to),
rc = netfs_buffered_read_iter(iocb, to); tcon->ses->server->vals->shared_lock_type,
0, NULL, CIFS_READ_OP))
rc = netfs_unbuffered_read_iter_locked(iocb, to);
up_read(&cinode->lock_sem);
netfs_end_io_direct(inode);
} else {
rc = netfs_start_io_read(inode);
if (rc < 0)
goto out;
down_read(&cinode->lock_sem);
if (!cifs_find_lock_conflict(
cfile, iocb->ki_pos, iov_iter_count(to),
tcon->ses->server->vals->shared_lock_type,
0, NULL, CIFS_READ_OP))
rc = filemap_read(iocb, to, 0);
up_read(&cinode->lock_sem);
netfs_end_io_read(inode);
} }
up_read(&cinode->lock_sem); out:
return rc; return rc;
} }
......
...@@ -34,11 +34,8 @@ ...@@ -34,11 +34,8 @@
static void cifs_set_netfs_context(struct inode *inode) static void cifs_set_netfs_context(struct inode *inode)
{ {
struct cifsInodeInfo *cifs_i = CIFS_I(inode); struct cifsInodeInfo *cifs_i = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
netfs_inode_init(&cifs_i->netfs, &cifs_req_ops, true); netfs_inode_init(&cifs_i->netfs, &cifs_req_ops, true);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)
__set_bit(NETFS_ICTX_WRITETHROUGH, &cifs_i->netfs.flags);
} }
static void cifs_set_ops(struct inode *inode) static void cifs_set_ops(struct inode *inode)
......
...@@ -145,7 +145,7 @@ struct durable_context_v2 { ...@@ -145,7 +145,7 @@ struct durable_context_v2 {
} __packed; } __packed;
struct create_durable_v2 { struct create_durable_v2 {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct durable_context_v2 dcontext; struct durable_context_v2 dcontext;
} __packed; } __packed;
...@@ -167,7 +167,7 @@ struct durable_reconnect_context_v2_rsp { ...@@ -167,7 +167,7 @@ struct durable_reconnect_context_v2_rsp {
} __packed; } __packed;
struct create_durable_handle_reconnect_v2 { struct create_durable_handle_reconnect_v2 {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct durable_reconnect_context_v2 dcontext; struct durable_reconnect_context_v2 dcontext;
__u8 Pad[4]; __u8 Pad[4];
...@@ -175,7 +175,7 @@ struct create_durable_handle_reconnect_v2 { ...@@ -175,7 +175,7 @@ struct create_durable_handle_reconnect_v2 {
/* See MS-SMB2 2.2.13.2.5 */ /* See MS-SMB2 2.2.13.2.5 */
struct crt_twarp_ctxt { struct crt_twarp_ctxt {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le64 Timestamp; __le64 Timestamp;
...@@ -183,12 +183,12 @@ struct crt_twarp_ctxt { ...@@ -183,12 +183,12 @@ struct crt_twarp_ctxt {
/* See MS-SMB2 2.2.13.2.9 */ /* See MS-SMB2 2.2.13.2.9 */
struct crt_query_id_ctxt { struct crt_query_id_ctxt {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
} __packed; } __packed;
struct crt_sd_ctxt { struct crt_sd_ctxt {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct smb3_sd sd; struct smb3_sd sd;
} __packed; } __packed;
...@@ -415,7 +415,7 @@ struct smb2_posix_info_parsed { ...@@ -415,7 +415,7 @@ struct smb2_posix_info_parsed {
}; };
struct smb2_create_ea_ctx { struct smb2_create_ea_ctx {
struct create_context ctx; struct create_context_hdr ctx;
__u8 name[8]; __u8 name[8];
struct smb2_file_full_ea_info ea; struct smb2_file_full_ea_info ea;
} __packed; } __packed;
......
...@@ -1171,12 +1171,15 @@ struct smb2_server_client_notification { ...@@ -1171,12 +1171,15 @@ struct smb2_server_client_notification {
#define SMB2_CREATE_FLAG_REPARSEPOINT 0x01 #define SMB2_CREATE_FLAG_REPARSEPOINT 0x01
struct create_context { struct create_context {
__le32 Next; /* New members must be added within the struct_group() macro below. */
__le16 NameOffset; __struct_group(create_context_hdr, hdr, __packed,
__le16 NameLength; __le32 Next;
__le16 Reserved; __le16 NameOffset;
__le16 DataOffset; __le16 NameLength;
__le32 DataLength; __le16 Reserved;
__le16 DataOffset;
__le32 DataLength;
);
__u8 Buffer[]; __u8 Buffer[];
} __packed; } __packed;
...@@ -1222,7 +1225,7 @@ struct smb2_create_rsp { ...@@ -1222,7 +1225,7 @@ struct smb2_create_rsp {
} __packed; } __packed;
struct create_posix { struct create_posix {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[16]; __u8 Name[16];
__le32 Mode; __le32 Mode;
__u32 Reserved; __u32 Reserved;
...@@ -1230,7 +1233,7 @@ struct create_posix { ...@@ -1230,7 +1233,7 @@ struct create_posix {
/* See MS-SMB2 2.2.13.2.3 and MS-SMB2 2.2.13.2.4 */ /* See MS-SMB2 2.2.13.2.3 and MS-SMB2 2.2.13.2.4 */
struct create_durable { struct create_durable {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
union { union {
__u8 Reserved[16]; __u8 Reserved[16];
...@@ -1243,14 +1246,14 @@ struct create_durable { ...@@ -1243,14 +1246,14 @@ struct create_durable {
/* See MS-SMB2 2.2.13.2.5 */ /* See MS-SMB2 2.2.13.2.5 */
struct create_mxac_req { struct create_mxac_req {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le64 Timestamp; __le64 Timestamp;
} __packed; } __packed;
/* See MS-SMB2 2.2.14.2.5 */ /* See MS-SMB2 2.2.14.2.5 */
struct create_mxac_rsp { struct create_mxac_rsp {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le32 QueryStatus; __le32 QueryStatus;
__le32 MaximalAccess; __le32 MaximalAccess;
...@@ -1286,13 +1289,13 @@ struct lease_context_v2 { ...@@ -1286,13 +1289,13 @@ struct lease_context_v2 {
} __packed; } __packed;
struct create_lease { struct create_lease {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct lease_context lcontext; struct lease_context lcontext;
} __packed; } __packed;
struct create_lease_v2 { struct create_lease_v2 {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct lease_context_v2 lcontext; struct lease_context_v2 lcontext;
__u8 Pad[4]; __u8 Pad[4];
...@@ -1300,7 +1303,7 @@ struct create_lease_v2 { ...@@ -1300,7 +1303,7 @@ struct create_lease_v2 {
/* See MS-SMB2 2.2.14.2.9 */ /* See MS-SMB2 2.2.14.2.9 */
struct create_disk_id_rsp { struct create_disk_id_rsp {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le64 DiskFileId; __le64 DiskFileId;
__le64 VolumeId; __le64 VolumeId;
...@@ -1309,7 +1312,7 @@ struct create_disk_id_rsp { ...@@ -1309,7 +1312,7 @@ struct create_disk_id_rsp {
/* See MS-SMB2 2.2.13.2.13 */ /* See MS-SMB2 2.2.13.2.13 */
struct create_app_inst_id { struct create_app_inst_id {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[16]; __u8 Name[16];
__le32 StructureSize; /* Must be 20 */ __le32 StructureSize; /* Must be 20 */
__u16 Reserved; __u16 Reserved;
...@@ -1318,7 +1321,7 @@ struct create_app_inst_id { ...@@ -1318,7 +1321,7 @@ struct create_app_inst_id {
/* See MS-SMB2 2.2.13.2.15 */ /* See MS-SMB2 2.2.13.2.15 */
struct create_app_inst_id_vers { struct create_app_inst_id_vers {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[16]; __u8 Name[16];
__le32 StructureSize; /* Must be 24 */ __le32 StructureSize; /* Must be 24 */
__u16 Reserved; __u16 Reserved;
......
...@@ -64,7 +64,7 @@ struct preauth_integrity_info { ...@@ -64,7 +64,7 @@ struct preauth_integrity_info {
#define SMB2_SESSION_TIMEOUT (10 * HZ) #define SMB2_SESSION_TIMEOUT (10 * HZ)
struct create_durable_req_v2 { struct create_durable_req_v2 {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le32 Timeout; __le32 Timeout;
__le32 Flags; __le32 Flags;
...@@ -73,7 +73,7 @@ struct create_durable_req_v2 { ...@@ -73,7 +73,7 @@ struct create_durable_req_v2 {
} __packed; } __packed;
struct create_durable_reconn_req { struct create_durable_reconn_req {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
union { union {
__u8 Reserved[16]; __u8 Reserved[16];
...@@ -85,7 +85,7 @@ struct create_durable_reconn_req { ...@@ -85,7 +85,7 @@ struct create_durable_reconn_req {
} __packed; } __packed;
struct create_durable_reconn_v2_req { struct create_durable_reconn_v2_req {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct { struct {
__u64 PersistentFileId; __u64 PersistentFileId;
...@@ -96,13 +96,13 @@ struct create_durable_reconn_v2_req { ...@@ -96,13 +96,13 @@ struct create_durable_reconn_v2_req {
} __packed; } __packed;
struct create_alloc_size_req { struct create_alloc_size_req {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le64 AllocationSize; __le64 AllocationSize;
} __packed; } __packed;
struct create_durable_rsp { struct create_durable_rsp {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
union { union {
__u8 Reserved[8]; __u8 Reserved[8];
...@@ -114,7 +114,7 @@ struct create_durable_rsp { ...@@ -114,7 +114,7 @@ struct create_durable_rsp {
/* Flags */ /* Flags */
#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002 #define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
struct create_durable_v2_rsp { struct create_durable_v2_rsp {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
__le32 Timeout; __le32 Timeout;
__le32 Flags; __le32 Flags;
...@@ -122,7 +122,7 @@ struct create_durable_v2_rsp { ...@@ -122,7 +122,7 @@ struct create_durable_v2_rsp {
/* equivalent of the contents of SMB3.1.1 POSIX open context response */ /* equivalent of the contents of SMB3.1.1 POSIX open context response */
struct create_posix_rsp { struct create_posix_rsp {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[16]; __u8 Name[16];
__le32 nlink; __le32 nlink;
__le32 reparse_tag; __le32 reparse_tag;
...@@ -381,13 +381,13 @@ struct smb2_ea_info { ...@@ -381,13 +381,13 @@ struct smb2_ea_info {
} __packed; /* level 15 Query */ } __packed; /* level 15 Query */
struct create_ea_buf_req { struct create_ea_buf_req {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct smb2_ea_info ea; struct smb2_ea_info ea;
} __packed; } __packed;
struct create_sd_buf_req { struct create_sd_buf_req {
struct create_context ccontext; struct create_context_hdr ccontext;
__u8 Name[8]; __u8 Name[8];
struct smb_ntsd ntsd; struct smb_ntsd ntsd;
} __packed; } __packed;
......
...@@ -389,6 +389,7 @@ struct netfs_cache_ops { ...@@ -389,6 +389,7 @@ struct netfs_cache_ops {
}; };
/* High-level read API. */ /* High-level read API. */
ssize_t netfs_unbuffered_read_iter_locked(struct kiocb *iocb, struct iov_iter *iter);
ssize_t netfs_unbuffered_read_iter(struct kiocb *iocb, struct iov_iter *iter); ssize_t netfs_unbuffered_read_iter(struct kiocb *iocb, struct iov_iter *iter);
ssize_t netfs_buffered_read_iter(struct kiocb *iocb, struct iov_iter *iter); ssize_t netfs_buffered_read_iter(struct kiocb *iocb, struct iov_iter *iter);
ssize_t netfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter); ssize_t netfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment