From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23062C10DCE for ; Thu, 7 Dec 2023 06:41:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 699DE6B0075; Thu, 7 Dec 2023 01:41:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 648FA6B0078; Thu, 7 Dec 2023 01:41:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 50FC16B007B; Thu, 7 Dec 2023 01:41:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 41E1F6B0075 for ; Thu, 7 Dec 2023 01:41:10 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 00C201601B4 for ; Thu, 7 Dec 2023 06:41:09 +0000 (UTC) X-FDA: 81539075100.14.DE24F31 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf17.hostedemail.com (Postfix) with ESMTP id 423A84000C for ; Thu, 7 Dec 2023 06:41:06 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of libaokun1@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=libaokun1@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701931268; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wAw6AwZOIzgyf5tpHIyGAyQOPtraAxSseT4KQzZaa0c=; b=G9mC+PY381owqhnSkM93GgagPaKvgHDGWrP3Vtzzu3WK5TgDzny0t+YKsPFH+3iEIuT4C0 tH5+TaDwPWnU+jHV/0tvHEtUW6/OVYCMg2B009jiOE1r4chcPr1l8swg9jyc+TzlB3RgQ4 l7Ux+jysH0j64kuSllZ/FkO7Hdt6LbU= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of libaokun1@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=libaokun1@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701931268; a=rsa-sha256; cv=none; b=h5RrY0KUEF6zwfYK4+CDqm8RbfV6P1rl+xdALhw3H6GBazbIeE7JSc+IoUeSz02yHWEUuK NsVG8evDhgtuPnM7Oi5d3PJoy2SFrr/G4vUFACCdhBtHm7rF7Y2Ql47WrAQdnkSRgbGMmP OJtQRI0AMeWaWaFJqEsI8NAmAmYexdo= Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Sm4KZ5VHWz14LrF; Thu, 7 Dec 2023 14:36:02 +0800 (CST) Received: from [10.174.177.174] (10.174.177.174) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 7 Dec 2023 14:41:01 +0800 Message-ID: Date: Thu, 7 Dec 2023 14:41:01 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH -RFC 0/2] mm/ext4: avoid data corruption when extending DIO write race with buffered read Content-Language: en-US To: Theodore Ts'o CC: Jan Kara , , , , , , , , , , , Baokun Li References: <20231202091432.8349-1-libaokun1@huawei.com> <20231204121120.mpxntey47rluhcfi@quack3> <20231205041755.GG509422@mit.edu> <20231206215529.GK509422@mit.edu> From: Baokun Li In-Reply-To: <20231206215529.GK509422@mit.edu> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.174] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500021.china.huawei.com (7.185.36.21) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 423A84000C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: mwkasppfsz1p5us9jqnh1xcu58pr8c9g X-HE-Tag: 1701931266-724484 X-HE-Meta: U2FsdGVkX18h14sTkyz6zpx7L52YqeVJnszWv7EpXNAJMZwo+4KGrhc5Z0PoOqak8q2XmjiOFDUuhkuhii0Oe5g6Ts67DWj0SKsFIk06cfnNR4hHScVVOUJFOVEninK8E1ZtC3E9rEMXwb+ysXIyNzjAl6hQJxMtgfTofDiPIEiOR4Ha0Ui/NH+uV6TZHBm7mb35hiS0C2alqJjF7aHwutKaX+WAHIkqtr9XAMbIpW69eg6OCygJ20oISxE6KZ2xvYkRChiN9occy8ffn6hhtHi9my6usD0tKrjAupg52yxRkx4WnPYYLuh9LNORTXrYdkXdQzFm8CeYzF1voYFFCvfArqGe9ADWMsVRL1nB/P8f7beAZZRqK41txgDvprgtsgH/EL5QBfBEHjEzCfq3Se0LFtwlJQqjNC8HMOSqiiaY2sLWviNe7GUVoITgX8GSaAOCvvupr9JBLW8n6LxieTwocUU0iHDFiH4/qUnxSHa/ukGdnTKiSwNNUy1qZh7Y5BBFOhxakgMM1QgfKcnGE5TMSm3Lm+kCivDkMQjcLhlGAUdiwDkq7itLJyA8mBowGsNhmBTiPYTYvpD9kAuggvH8EUkSsZIGHT53E+ut9vnC3aFiH3n7C3DCwmKjeDqVY/UN/W2gwWrSmUP8C6YD70HXLVuczMczHe3M4YRHkco017VsFvzSEd5pTi7VJUy4S0e/yYahb6g/Qk05yBQjlov7w9rhcfGiG4/aoNeyL1Z8MAvGuLu30XFsjDd66cikcNy889O0l3lhAGOtYz2rEt0qJuGjBi0HGb+cS7bSyX16B2OKI6Hjwf7f8YbirK0OjbA7GpcfBwBHiKPMWKwqjtGbk5eBtTR/Lu9ZymKWWv9juJHIc/b8/k/7b3zeL1JXatXrIB8wUEd/s3aCCDjUinmBisX1l5zUn2trxX7/utw8lmn9BwltyjvrfmBROMNhfn3+fBRom9rcTG8bzWq gxUvMWw4 Bh5PkL8KiSqZfSe8S9bGR0O2AeOSPDCQfbWELfXBeog3SFE+jocNp4cY/e06LPsPhRS1XfFx05ThLSPkA6u6wW6E9tDEs46U3zssUdSteiOanI4MTqgzuIpjBZI+ervrS2HmytJSIYC5ogNGL73j0Y+o1UNShDn8VoqV+rS0N/HAQhZg34ukFpJsJgPsvV7RuLlSx11IAjyVJofj6MHp2H4tg5PMN/yfiT1kZ5TrRrAYiVGtoSFiFcnzZyxO6Xwb1Ze0VaQW/Vclh5ANsON4/+sE5Xg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2023/12/7 5:55, Theodore Ts'o wrote: > On Tue, Dec 05, 2023 at 09:19:03PM +0800, Baokun Li wrote: >> Thank you very much for your detailed explanation! >> But the downstream users do have buffered reads to read the relay log >> file, as I confirmed with bpftrace. Here's an introduction to turning on >> relay logging, but I'm not sure if you can access this link: >> https://blog.csdn.net/javaanddonet/article/details/112596148 > Well, if a mysql-supplied program is trying read the relay log using a > buffered read, when it's being written using Direct I/O, that's a bug > in mysql, and it should be reported as such to the mysql folks. I was mistaken here, it now looks like reads and writes to the relay log are buffered IO, and I'm still trying to locate the issue. > > It does look like there is a newer way of doing replication which > doesn't rely on messign with log files. From: > > https://dev.mysql.com/doc/refman/8.0/en/replication.html > > MySQL 8.0 supports different methods of replication. The > traditional method is based on replicating events from the > source's binary log, and requires the log files and positions in > them to be synchronized between source and replica. The newer > method based on global transaction identifiers (GTIDs) is > transactional and therefore does not require working with log > files or positions within these files, which greatly simplifies > many common replication tasks. Replication using GTIDs guarantees > consistency between source and replica as long as all transactions > committed on the source have also been applied on the replica. For > more information about GTIDs and GTID-based replication in MySQL, > see Section 17.1.3, “Replication with Global Transaction > Identifiers”. For information on using binary log file position > based replication, see Section 17.1, “Configuring Replication”. > > Perhaps you can try and see how mysql handles GTID-based replication > using bpftrace? > > Cheers, > > - Ted Thank you very much for your solution! I'll try it. Thanks! -- With Best Regards, Baokun Li .