Skip to content

Commit e5b0208

Browse files
committed
Merge tag '5.19-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd
Pull ksmbd server updates from Steve French: - rdma (smbdirect) fixes, cleanup and optimizations - crediting (flow control) fix for mounts from Windows client - ACL fix - Windows client query dir fix - write validation fix - cleanups * tag '5.19-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd: ksmbd: smbd: relax the count of sges required ksmbd: fix outstanding credits related bugs ksmbd: smbd: fix connection dropped issue ksmbd: Fix some kernel-doc comments ksmbd: fix wrong smbd max read/write size check ksmbd: add smbd max io size parameter ksmbd: handle smb2 query dir request for OutputBufferLength that is too small ksmbd: smbd: handle multiple Buffer descriptors ksmbd: smbd: change the return value of get_sg_list ksmbd: smbd: simplify tracking pending packets ksmbd: smbd: introduce read/write credits for RDMA read/write ksmbd: smbd: change prototypes of RDMA read/write related functions ksmbd: validate length in smb2_write() ksmbd: fix reference count leak in smb_check_perm_dacl()
2 parents 17eabd4 + 621433b commit e5b0208

File tree

11 files changed

+325
-244
lines changed

11 files changed

+325
-244
lines changed

fs/ksmbd/connection.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct ksmbd_conn *ksmbd_conn_alloc(void)
6262
atomic_set(&conn->req_running, 0);
6363
atomic_set(&conn->r_count, 0);
6464
conn->total_credits = 1;
65-
conn->outstanding_credits = 1;
65+
conn->outstanding_credits = 0;
6666

6767
init_waitqueue_head(&conn->req_running_q);
6868
INIT_LIST_HEAD(&conn->conns_list);
@@ -205,31 +205,31 @@ int ksmbd_conn_write(struct ksmbd_work *work)
205205
return 0;
206206
}
207207

208-
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, void *buf,
209-
unsigned int buflen, u32 remote_key, u64 remote_offset,
210-
u32 remote_len)
208+
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,
209+
void *buf, unsigned int buflen,
210+
struct smb2_buffer_desc_v1 *desc,
211+
unsigned int desc_len)
211212
{
212213
int ret = -EINVAL;
213214

214215
if (conn->transport->ops->rdma_read)
215216
ret = conn->transport->ops->rdma_read(conn->transport,
216217
buf, buflen,
217-
remote_key, remote_offset,
218-
remote_len);
218+
desc, desc_len);
219219
return ret;
220220
}
221221

222-
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, void *buf,
223-
unsigned int buflen, u32 remote_key,
224-
u64 remote_offset, u32 remote_len)
222+
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn,
223+
void *buf, unsigned int buflen,
224+
struct smb2_buffer_desc_v1 *desc,
225+
unsigned int desc_len)
225226
{
226227
int ret = -EINVAL;
227228

228229
if (conn->transport->ops->rdma_write)
229230
ret = conn->transport->ops->rdma_write(conn->transport,
230231
buf, buflen,
231-
remote_key, remote_offset,
232-
remote_len);
232+
desc, desc_len);
233233
return ret;
234234
}
235235

fs/ksmbd/connection.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,14 @@ struct ksmbd_transport_ops {
122122
int (*writev)(struct ksmbd_transport *t, struct kvec *iovs, int niov,
123123
int size, bool need_invalidate_rkey,
124124
unsigned int remote_key);
125-
int (*rdma_read)(struct ksmbd_transport *t, void *buf, unsigned int len,
126-
u32 remote_key, u64 remote_offset, u32 remote_len);
127-
int (*rdma_write)(struct ksmbd_transport *t, void *buf,
128-
unsigned int len, u32 remote_key, u64 remote_offset,
129-
u32 remote_len);
125+
int (*rdma_read)(struct ksmbd_transport *t,
126+
void *buf, unsigned int len,
127+
struct smb2_buffer_desc_v1 *desc,
128+
unsigned int desc_len);
129+
int (*rdma_write)(struct ksmbd_transport *t,
130+
void *buf, unsigned int len,
131+
struct smb2_buffer_desc_v1 *desc,
132+
unsigned int desc_len);
130133
};
131134

132135
struct ksmbd_transport {
@@ -148,12 +151,14 @@ struct ksmbd_conn *ksmbd_conn_alloc(void);
148151
void ksmbd_conn_free(struct ksmbd_conn *conn);
149152
bool ksmbd_conn_lookup_dialect(struct ksmbd_conn *c);
150153
int ksmbd_conn_write(struct ksmbd_work *work);
151-
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn, void *buf,
152-
unsigned int buflen, u32 remote_key, u64 remote_offset,
153-
u32 remote_len);
154-
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn, void *buf,
155-
unsigned int buflen, u32 remote_key, u64 remote_offset,
156-
u32 remote_len);
154+
int ksmbd_conn_rdma_read(struct ksmbd_conn *conn,
155+
void *buf, unsigned int buflen,
156+
struct smb2_buffer_desc_v1 *desc,
157+
unsigned int desc_len);
158+
int ksmbd_conn_rdma_write(struct ksmbd_conn *conn,
159+
void *buf, unsigned int buflen,
160+
struct smb2_buffer_desc_v1 *desc,
161+
unsigned int desc_len);
157162
void ksmbd_conn_enqueue_request(struct ksmbd_work *work);
158163
int ksmbd_conn_try_dequeue_request(struct ksmbd_work *work);
159164
void ksmbd_conn_init_server_callbacks(struct ksmbd_conn_ops *ops);

fs/ksmbd/ksmbd_netlink.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ struct ksmbd_startup_request {
104104
*/
105105
__u32 sub_auth[3]; /* Subauth value for Security ID */
106106
__u32 smb2_max_credits; /* MAX credits */
107-
__u32 reserved[128]; /* Reserved room */
107+
__u32 smbd_max_io_size; /* smbd read write size */
108+
__u32 reserved[127]; /* Reserved room */
108109
__u32 ifc_list_sz; /* interfaces list size */
109110
__s8 ____payload[];
110111
};

fs/ksmbd/misc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* wildcard '*' and '?'
2121
* TODO : implement consideration about DOS_DOT, DOS_QM and DOS_STAR
2222
*
23-
* @string: string to compare with a pattern
23+
* @str: string to compare with a pattern
2424
* @len: string length
2525
* @pattern: pattern string which might include wildcard '*' and '?'
2626
*
@@ -152,8 +152,8 @@ int parse_stream_name(char *filename, char **stream_name, int *s_type)
152152
/**
153153
* convert_to_nt_pathname() - extract and return windows path string
154154
* whose share directory prefix was removed from file path
155-
* @filename : unix filename
156-
* @sharepath: share path string
155+
* @share: ksmbd_share_config pointer
156+
* @path: path to report
157157
*
158158
* Return : windows path string or error
159159
*/
@@ -250,8 +250,8 @@ char *ksmbd_extract_sharename(char *treename)
250250

251251
/**
252252
* convert_to_unix_name() - convert windows name to unix format
253-
* @path: name to be converted
254-
* @tid: tree id of mathing share
253+
* @share: ksmbd_share_config pointer
254+
* @name: file name that is relative to share
255255
*
256256
* Return: converted name on success, otherwise NULL
257257
*/

fs/ksmbd/smb2misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static int smb2_validate_credit_charge(struct ksmbd_conn *conn,
338338
ret = 1;
339339
}
340340

341-
if ((u64)conn->outstanding_credits + credit_charge > conn->vals->max_credits) {
341+
if ((u64)conn->outstanding_credits + credit_charge > conn->total_credits) {
342342
ksmbd_debug(SMB, "Limits exceeding the maximum allowable outstanding requests, given : %u, pending : %u\n",
343343
credit_charge, conn->outstanding_credits);
344344
ret = 1;

0 commit comments

Comments
 (0)