Re: [PATCH v4] scsi: target: tcmu: Fix possible data corruption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

+		 */
+		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;



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux