All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: Sagi Grimberg <sagig@dev.mellanox.co.il>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	target-devel@vger.kernel.org,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [RFC] Simlify dif_verify routines and fixup fileio protection information code.
Date: Wed, 15 Apr 2015 23:16:04 +0900	[thread overview]
Message-ID: <CAC5umygGG4BTs0u35eVi6dLhoDuDshGNPsQaWq2kO5YexWDP+Q@mail.gmail.com> (raw)
In-Reply-To: <552E384F.3030203@dev.mellanox.co.il>

[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]

2015-04-15 19:07 GMT+09:00 Sagi Grimberg <sagig@dev.mellanox.co.il>:
> On 4/15/2015 2:52 AM, Akinobu Mita wrote:
>
>>>>
>>>> Looks good...
>>>>
>>>> I'll test with these patches and check if the problems I met
>>>> disappear.
>>>
>>>
>>>
>>> Thanks Akinobu,
>>>
>>> Waiting to hear your verdict before sending a formal patchset.
>>
>>
>> I hit a original bug in sbc_dif_verify() which is not introduced by
>> your patch set, though.
>
>
> What is this original bug?

I meant to say about the problem I fixed by fix-sbc_dif_verify.patch.

>>  Please consider to include attached patch.
>
>
> I'll include it. thanks.
>
>> I'm still seeing another problem and trying to find out a root cause,
>> but it seems like it's caused by other change in -next.
>>
>
> care to elaborate?

When mounting ext4 filesystem at the first time after mkfs, a lot of
WRITE_SAME commands are issued for lazy initialization or something.

By the commit 436f4a0a ("loopback: Add fabric_prot_type attribute
support"), When WRITE_SAME command with WRPROTECT=0 is executed,
sbc_dif_generate() is called but cmd->t_prot_sg is NULL as block layer
didn't allocate it for WRITE_SAME.

I could work around with the attached patch, as the WRITE_SAME command
will fail after all when protection info is enabled with FILEIO, we only need to
avoid null pointer dereference.  But I need to ask Nic about the right
way to fix.

For this patch set, please feel free to add:

Tested-by: Akinobu Mita <akinobu.mita@gmail.com>

[-- Attachment #2: fix-sbc_dif_generate.patch --]
[-- Type: text/x-patch, Size: 485 bytes --]

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 3d88c00..d8d6267 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -1183,6 +1183,9 @@ sbc_dif_generate(struct se_cmd *cmd)
 	void *daddr, *paddr;
 	int i, j, offset = 0;
 
+	if (!psg)
+		return;
+
 	for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) {
 		daddr = kmap_atomic(sg_page(dsg)) + dsg->offset;
 		paddr = kmap_atomic(sg_page(psg)) + psg->offset;

  reply	other threads:[~2015-04-15 14:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 17:19 [RFC] Simlify dif_verify routines and fixup fileio protection information code Sagi Grimberg
2015-04-13 17:19 ` [PATCH RFC 1/2] target: Merge sbc_verify_dif_read|write Sagi Grimberg
2015-04-13 17:19 ` [PATCH RFC 2/2] target/file: Remove fd_prot bounce buffer Sagi Grimberg
2015-04-14  1:23 ` [RFC] Simlify dif_verify routines and fixup fileio protection information code Martin K. Petersen
2015-04-14 12:17 ` Akinobu Mita
2015-04-14 17:20   ` Sagi Grimberg
2015-04-14 23:52     ` Akinobu Mita
2015-04-15 10:07       ` Sagi Grimberg
2015-04-15 14:16         ` Akinobu Mita [this message]
2015-04-15 14:33           ` Sagi Grimberg
2015-04-15 15:05             ` Martin K. Petersen
2015-04-15 15:08             ` Sagi Grimberg
2015-04-15 16:10               ` Martin K. Petersen
2015-04-16  8:52                 ` Sagi Grimberg
2015-04-16 13:46                   ` Akinobu Mita
2015-04-16 15:30                     ` Martin K. Petersen
2015-04-16 15:58                     ` Sagi Grimberg
2015-04-16 16:04                       ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAC5umygGG4BTs0u35eVi6dLhoDuDshGNPsQaWq2kO5YexWDP+Q@mail.gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nab@linux-iscsi.org \
    --cc=sagig@dev.mellanox.co.il \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.