Message ID | 1488962743-17028-5-git-send-email-lixiubo@cmss.chinamobile.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On 2017年03月08日 16:45, lixiubo@cmss.chinamobile.com wrote: > From: Xiubo Li <lixiubo@cmss.chinamobile.com> > > The t_data_nents and t_bidi_data_nents are all the numbers of the > segments, and we couldn't be sure the size of the data area block > will equal to size of the segment. > > Use the actually block number needed intead of the sum of segments. > > Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> > --- > drivers/target/target_core_user.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c > index 99cd239..117be07 100644 > --- a/drivers/target/target_core_user.c > +++ b/drivers/target/target_core_user.c > @@ -650,8 +650,7 @@ static bool is_ring_space_avail(struct tcmu_dev *udev, struct tcmu_cmd *cmd, > * expensive to tell how many regions are freed in the bitmap > */ > base_command_size = max(offsetof(struct tcmu_cmd_entry, > - req.iov[se_cmd->t_bidi_data_nents + > - se_cmd->t_data_nents]), > + req.iov[tcmu_cmd->dbi_len]), For the old code: If the segment size is larger than the DATA_BLOCK_SIZE, and at the same time all the data blocks won't be continues between each other(that to say each block will use one iov: iov_cnt == block cnt > nents), the entry's cdb data will overlap with entry's iov[] data. Thanks, BRs Xiubo > sizeof(struct tcmu_cmd_entry)); > command_size = base_command_size > + round_up(scsi_command_size(se_cmd->t_task_cdb), TCMU_OP_ALIGN_SIZE); -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 99cd239..117be07 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -650,8 +650,7 @@ static bool is_ring_space_avail(struct tcmu_dev *udev, struct tcmu_cmd *cmd, * expensive to tell how many regions are freed in the bitmap */ base_command_size = max(offsetof(struct tcmu_cmd_entry, - req.iov[se_cmd->t_bidi_data_nents + - se_cmd->t_data_nents]), + req.iov[tcmu_cmd->dbi_len]), sizeof(struct tcmu_cmd_entry)); command_size = base_command_size + round_up(scsi_command_size(se_cmd->t_task_cdb), TCMU_OP_ALIGN_SIZE);