public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
To: Bodo Stroesser <bostroesser@gmail.com>,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH v4] scsi: target: tcmu: Fix possible data corruption
Date: Thu, 21 Apr 2022 10:41:11 +0800	[thread overview]
Message-ID: <1c0ffbd6-7ab5-e598-b4f2-fd6e9b932204@linux.alibaba.com> (raw)
In-Reply-To: <5015edcc-0b62-4c1f-d4f4-ec0d7a1470d7@gmail.com>

hi,

> Hi,
>
> just some remarks regarding the new comment.
>
> Bodo
>
> On 17.04.22 07:26, Xiaoguang Wang wrote:
>
> ... snip ...
>
>>   static const struct vm_operations_struct tcmu_vm_ops = {
>> @@ -3205,12 +3228,19 @@ static void find_free_blocks(void)
>>               udev->dbi_max = block;
>>           }
>>   +        /*
>> +         * Release the block pages.
>> +         * Also note that since tcmu_vma_fault() gets one extra page
>> +         * refcount, tcmu_blocks_release() won't free pages if pages
>> +         * are in page fault procedure, which means it's safe to
>
> s/in page fault procedure/mapped/
>
>> +         * call tcmu_blocks_release() before unmap_mapping_range().
>
> "... before unmap_mapping_range(), which drops the refcount of pages it
> unmaps and thus releases those pages."
>
> Please feel free to find an even better wording.
Yours seems better, just apply your suggestions.
I'm not a native english speaker :)

Regards,
Xiaoguang Wang
>
>> +         */
>> +        pages_freed = tcmu_blocks_release(udev, start, end - 1);
>> +
>>           /* Here will truncate the data area from off */
>>           off = udev->data_off + (loff_t)start * udev->data_blk_size;
>>           unmap_mapping_range(udev->inode->i_mapping, off, 0, 1);
>>   -        /* Release the block pages */
>> -        pages_freed = tcmu_blocks_release(udev, start, end - 1);
>>           mutex_unlock(&udev->cmdr_lock);
>>             total_pages_freed += pages_freed;


      reply	other threads:[~2022-04-21  2:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17  5:26 [PATCH v4] scsi: target: tcmu: Fix possible data corruption Xiaoguang Wang
2022-04-18 18:40 ` Bodo Stroesser
2022-04-21  2:41   ` Xiaoguang Wang [this message]

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=1c0ffbd6-7ab5-e598-b4f2-fd6e9b932204@linux.alibaba.com \
    --to=xiaoguang.wang@linux.alibaba.com \
    --cc=bostroesser@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox