On Thu, Jun 11, 2020 at 09:23:33PM +0530, Dakshaja Uppalapati wrote: > The below error is seen in dmesg, while formatting the disks discovered on host. > > dmesg: > [ 636.733374] blk_update_request: I/O error, dev nvme4n1, sector 0 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0 > > Patch 6 fixes it and there are 5 other dependent patches that also need to be > pulled from upstream to stable, 5.4 and 4.19 branches. > > Patch 1 dependent patch > > Patch 2 dependent patch > > Patch 3 dependent patch > > Patch 4 dependent patch > > Patch 5 dependent patch > > Patch 6 fix patch 1. You need to copy the linux-nvme mainling list for linux nvme kernel patches. 2. If you're sending someone else's patch, the patch is supposed to have the From: tag so the author is appropriately identified. 3. Stable patches must referece the upstream commit ID. As for this particular issue, while stable patches are required to reference an upstream commit, you don't need to bring in dependent patches. You are allowed to write an equivalent fix specific to the stable branch so that stable doesn't need to take a bunch of unrelated changes. For example, it looks like this particular isssue can be fixed with the following simple stable patch: --- diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c index 1096dd01ca22..9399e23e69c3 100644 --- a/drivers/nvme/target/io-cmd-bdev.c +++ b/drivers/nvme/target/io-cmd-bdev.c @@ -234,8 +234,8 @@ u16 nvmet_bdev_parse_io_cmd(struct nvmet_req *req) return 0; case nvme_cmd_dsm: req->execute = nvmet_bdev_execute_dsm; - req->data_len = (le32_to_cpu(cmd->dsm.nr) + 1) * - sizeof(struct nvme_dsm_range); + req->data_len = max((le32_to_cpu(cmd->dsm.nr) + 1) * + sizeof(struct nvme_dsm_range), req->transfer_len); return 0; case nvme_cmd_write_zeroes: req->execute = nvmet_bdev_execute_write_zeroes; diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c index 39d972e2595f..f2fa6482d6dd 100644 --- a/drivers/nvme/target/io-cmd-file.c +++ b/drivers/nvme/target/io-cmd-file.c @@ -332,8 +332,8 @@ u16 nvmet_file_parse_io_cmd(struct nvmet_req *req) return 0; case nvme_cmd_dsm: req->execute = nvmet_file_execute_dsm; - req->data_len = (le32_to_cpu(cmd->dsm.nr) + 1) * - sizeof(struct nvme_dsm_range); + req->data_len = max((le32_to_cpu(cmd->dsm.nr) + 1) * + sizeof(struct nvme_dsm_range), req->transfer_len); return 0; case nvme_cmd_write_zeroes: req->execute = nvmet_file_execute_write_zeroes; --