Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2218223pxb; Tue, 12 Oct 2021 01:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSaMh/N82hSU0EsmPxJ9mdQ5X29UVkJsabuNvyt/IMfahOtduEOSzXpJAIaQYQV/5AN13V X-Received: by 2002:a17:906:b184:: with SMTP id w4mr30428089ejy.418.1634028558276; Tue, 12 Oct 2021 01:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634028558; cv=none; d=google.com; s=arc-20160816; b=kMAZZDhjLooynkmT1G3/VnZvV1vejhSWV8f5gr0SjsP7OTuL8BcFbYtyUvU497pT5P IUaOWvvIhK6WZlAyntTanF1G/SPiVgfaILAhgoQSOS96f5t1RB2tFYNnv85B6m8Xb6Dp AGANw0CgQzuQYh1KgIYhp9sXQ+cW7SoAQe3SyFGohrxPX5LmjFielVWsA2ypt/+foxUd 3clGFvD5y04yBHU1elJiPd8qby05pP5uP1XrU5hDforvxXfTAv/i+dyXOSjlr/P+wQ9B qEHSvZD/fKnviHYjW4BumQqbcpYowygIQXc6fqYHZj5ekoahDNO8nKlaXoXi1l6wiCsu AYqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=1H9U6FZdTMLg0N90m1o6mLcfzhK9dGZJ71HH3rnxZXg=; b=AvOVLtmT3IsS7jOscQw7kaBVW9abPDq83niZsJTQ35iMx4WsTCCBGLu1C4YIsrCDjd OjOegWpRoLwU4o0c8EJtohJEkyro2KUgYHN/XCaVWzmS4zEVc5kenH/6RZFR+JB2HHeq k6RtjtZcgltbsc2qzSaxAoPSL8ZyBqkaDxNUpmersWIt8SkuL62gNP60P78znaZUn4F5 n0yXQpyz82dL5dmZGQMWHgVNLVmzTso7Lv0Os6rZ5hWureyJZ/U3VwZEuaD+IC7kiPo8 SJlpzSNEG2al+u32rK1meECJz7m4pyX5/i30jH+0IZFeL212vPaJZNwnXrcfHaBqITKD 3Wow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="0/zM0Cyo"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fj2si20607002ejc.474.2021.10.12.01.48.51; Tue, 12 Oct 2021 01:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="0/zM0Cyo"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235175AbhJLItb (ORCPT + 99 others); Tue, 12 Oct 2021 04:49:31 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:44740 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235423AbhJLIta (ORCPT ); Tue, 12 Oct 2021 04:49:30 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 06FDC21FAC; Tue, 12 Oct 2021 08:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634028448; h=from:from:reply-to: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=1H9U6FZdTMLg0N90m1o6mLcfzhK9dGZJ71HH3rnxZXg=; b=0/zM0CyoZVl6slnTaJ8guNPB+tPsoONS7QulTscas9O52uPAXO/P74CbsWP6t2QmZ7mjOO yBZpDuJIxKjau+7DqC/wiDQHzCCsiKS6PC+H65k4MeQXd5+eUxAsntyZlpbAaEWU9QSDTM oywsMOL8YPr5OEbwctdoXT9pOv6SWcw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634028448; h=from:from:reply-to: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=1H9U6FZdTMLg0N90m1o6mLcfzhK9dGZJ71HH3rnxZXg=; b=h8hk2o8uMmL2kEjW6zhLNDHLdNKBvDKi6YGFFxAt1TRLJ5hZGHwS3eOSgSX+grWXVS3mrl 9NiPp+YqvMfqakCw== Received: from quack2.suse.cz (unknown [10.100.224.230]) by relay2.suse.de (Postfix) with ESMTP id ADE23A3B95; Tue, 12 Oct 2021 08:47:27 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 760561E1409; Tue, 12 Oct 2021 10:47:27 +0200 (CEST) Date: Tue, 12 Oct 2021 10:47:27 +0200 From: Jan Kara To: yebin Cc: Jan Kara , tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next v2 2/6] ext4: introduce last_check_time record previous check time Message-ID: <20211012084727.GF9697@quack2.suse.cz> References: <20210911090059.1876456-1-yebin10@huawei.com> <20210911090059.1876456-3-yebin10@huawei.com> <20211007123100.GG12712@quack2.suse.cz> <615FA55B.5070404@huawei.com> <615FAF27.8070000@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <615FAF27.8070000@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 08-10-21 10:38:31, yebin wrote: > On 2021/10/8 9:56, yebin wrote: > > On 2021/10/7 20:31, Jan Kara wrote: > > > On Sat 11-09-21 17:00:55, Ye Bin wrote: > > > > kmmpd: > > > > ... > > > > diff = jiffies - last_update_time; > > > > if (diff > mmp_check_interval * HZ) { > > > > ... > > > > As "mmp_check_interval = 2 * mmp_update_interval", 'diff' always little > > > > than 'mmp_update_interval', so there will never trigger detection. > > > > Introduce last_check_time record previous check time. > > > > > > > > Signed-off-by: Ye Bin > > > I think the check is there only for the case where write_mmp_block() + > > > sleep took longer than mmp_check_interval. I agree that should rarely > > > happen but on a really busy system it is possible and in that case > > > we would > > > miss updating mmp block for too long and so another node could have > > > started > > > using the filesystem. I actually don't see a reason why kmmpd should be > > > checking the block each mmp_check_interval as you do - > > > mmp_check_interval > > > is just for ext4_multi_mount_protect() to know how long it should wait > > > before considering mmp block stale... Am I missing something? > > > > > > Honza > > I'm sorry, I didn't understand the detection mechanism here before. Now > > I understand > > the detection mechanism here. > > As you said, it's just an abnormal protection. There's really no problem. > > > Yeah, i did test as following steps > hostA hostB > mount > ext4_multi_mount_protect -> seq == EXT4_MMP_SEQ_CLEAN > delay 5s after label "skip" so hostB will see seq is > EXT4_MMP_SEQ_CLEAN > mount > ext4_multi_mount_protect -> seq == EXT4_MMP_SEQ_CLEAN > run kmmpd > run kmmpd > > Actually,in this situation kmmpd will not detect confliction. > In ext4_multi_mount_protect function we write mmp data first and wait > 'wait_time * HZ' seconds, > read mmp data do check. Most of the time, If 'wait_time' is zero, it can pass > check. But how can be wait_time zero? As far as I'm reading the code, wait_time must be at least EXT4_MMP_MIN_CHECK_INTERVAL... Honza -- Jan Kara SUSE Labs, CR