Skip to content

Commit 777b521

Browse files
calebsanderigaw
authored andcommitted
ioctl: fix RAE bit on last Get Log Page command
If nvme_get_log_page() requires multiple Get Log Page commands because the total log length exceeds the transfer length, args->rae is overwritten, causing the RAE bit to be set in all commands. Retrieve the value of args->rae before overwriting it so the RAE bit is set as requested in the last command. Fixes: c23dbd4 ("linux: Change nvme_get_log_page to use nvme_get_log_args parm") Signed-off-by: Caleb Sander <[email protected]>
1 parent 4204cb3 commit 777b521

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/nvme/ioctl.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ int nvme_get_log_page(int fd, __u32 xfer_len, struct nvme_get_log_args *args)
434434
{
435435
__u64 offset = 0, xfer, data_len = args->len;
436436
__u64 start = args->lpo;
437-
bool retain = true;
437+
bool retain = args->rae;
438438
void *ptr = args->log;
439439
int ret;
440440

@@ -454,13 +454,10 @@ int nvme_get_log_page(int fd, __u32 xfer_len, struct nvme_get_log_args *args)
454454
* last portion of this log page so the data remains latched
455455
* during the fetch sequence.
456456
*/
457-
if (offset + xfer == data_len)
458-
retain = args->rae;
459-
460457
args->lpo = start + offset;
461458
args->len = xfer;
462459
args->log = ptr;
463-
args->rae = retain;
460+
args->rae = offset + xfer < data_len || retain;
464461
ret = nvme_get_log(args);
465462
if (ret)
466463
return ret;

0 commit comments

Comments
 (0)