Skip to content

Commit

Permalink
ksmbd: add ksmbd_iov_reset()
Browse files Browse the repository at this point in the history
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
namjaejeon committed Aug 7, 2023
1 parent 754b9d6 commit 6969739
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ksmbd_work.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,10 @@ int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len,
{
return __ksmbd_iov_pin_rsp(work, ib, len, aux_buf, aux_size);
}

void ksmbd_iov_reset(struct ksmbd_work *work)
{
work->iov_idx = 0;
work->iov_cnt = 0;
work->iov[0].iov_base = 0;
}
1 change: 1 addition & 0 deletions ksmbd_work.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,5 @@ bool ksmbd_queue_work(struct ksmbd_work *work);
int ksmbd_iov_pin_rsp_read(struct ksmbd_work *work, void *ib, int len,
void *aux_buf, unsigned int aux_size);
int ksmbd_iov_pin_rsp(struct ksmbd_work *work, void *ib, int len);
void ksmbd_iov_reset(struct ksmbd_work *work);
#endif /* __KSMBD_WORK_H__ */
1 change: 1 addition & 0 deletions oplock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ static int smb2_lease_break_noti(struct oplock_info *opinfo)
setup_async_work(in_work, NULL, NULL);
smb2_send_interim_resp(in_work, STATUS_PENDING);
list_del(&in_work->interim_entry);
ksmbd_iov_reset(in_work);
}
INIT_WORK(&work->work, __smb2_lease_break_noti);
ksmbd_queue_work(work);
Expand Down
6 changes: 4 additions & 2 deletions smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ int setup_async_work(struct ksmbd_work *work, void (*fn)(void **), void **arg)
struct ksmbd_conn *conn = work->conn;
int id;

rsp_hdr = smb2_get_msg(work->response_buf);
rsp_hdr = ksmbd_req_buf_next(work->response_buf);
rsp_hdr->Flags |= SMB2_FLAGS_ASYNC_COMMAND;

id = ksmbd_acquire_async_msg_id(&conn->async_ida);
Expand Down Expand Up @@ -711,7 +711,7 @@ void smb2_send_interim_resp(struct ksmbd_work *work, __le32 status)
{
struct smb2_hdr *rsp_hdr;

rsp_hdr = smb2_get_msg(work->response_buf);
rsp_hdr = ksmbd_req_buf_next(work->response_buf);
smb2_set_err_rsp(work);
rsp_hdr->Status = status;

Expand Down Expand Up @@ -7647,6 +7647,8 @@ int smb2_lock(struct ksmbd_work *work)
list_del(&work->fp_entry);
spin_unlock(&fp->f_lock);

ksmbd_iov_reset(work);

if (work->state != KSMBD_WORK_ACTIVE) {
list_del(&smb_lock->llist);
spin_lock(&work->conn->llist_lock);
Expand Down

0 comments on commit 6969739

Please sign in to comment.