Re: [PATCH v5 7/7] pmem: fix pmem_do_write() avoid writing to 'np' page

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

 



On 2/2/2022 5:28 AM, Christoph Hellwig wrote:
> On Fri, Jan 28, 2022 at 02:31:50PM -0700, Jane Chu wrote:
>> +	if (!bad_pmem) {
>>   		write_pmem(pmem_addr, page, page_off, len);
>> +	} else {
>> +		rc = pmem_clear_poison(pmem, pmem_off, len);
>> +		if (rc == BLK_STS_OK)
>> +			write_pmem(pmem_addr, page, page_off, len);
>> +		else
>> +			pr_warn("%s: failed to clear poison\n",
>> +				__func__);
> 
> This warning probably needs ratelimiting.

Will do, in case bad hardware is encountered, I can see lots of warnings.

> 
> Also this flow looks a little odd.  I'd redo the whole function with a
> clear bad_mem case:
> 
> 	if (unlikely(is_bad_pmem(&pmem->bb, sector, len))) {
> 		blk_status_t rc = pmem_clear_poison(pmem, pmem_off, len);
> 
> 		if (rc != BLK_STS_OK) {
> 			pr_warn("%s: failed to clear poison\n", __func__);
> 			return rc;
> 		}
> 	}
> 	flush_dcache_page(page);
> 	write_pmem(pmem_addr, page, page_off, len);
> 	return BLK_STS_OK;
> 
> 

This is much better, thanks for the suggestion!

-jane





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux