Re: [PATCH 1/5] md/raid1: fix potential data inconsistency issue with write behind device

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

 





On 6/18/19 11:41 AM, Guoqing Jiang wrote:

+static int check_and_add_wb(struct md_rdev *rdev, sector_t lo, sector_t hi)
+{
+       struct wb_info *wi;
+       unsigned long flags;
+       int ret = 0;
+       struct mddev *mddev = rdev->mddev;
+
+       wi = mempool_alloc(mddev->wb_info_pool, GFP_NOIO);
+
+       spin_lock_irqsave(&rdev->wb_list_lock, flags);
+       list_for_each_entry(wi, &rdev->wb_list, list) {
This doesn't look right. We should allocate wi from mempool after
the list_for_each_entry(), right?

Good catch, I will use an temp variable in the iteration since mempool_alloc
could sleep.

After a second thought, I think it should be fine since wi is either
reused to record the sector range or freed after the iteration.

Could you elaborate your concern? Thanks.

Guoqing




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux