Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1565975ybb; Thu, 9 Apr 2020 04:51:25 -0700 (PDT) X-Google-Smtp-Source: APiQypLYxTdWq5IurJFnR2+LWkQ47v6+15aajrtO6Wbj9n579Q2dNNb5Wpha0W0/DRNLKJbA9xz0 X-Received: by 2002:a37:a5c2:: with SMTP id o185mr12073515qke.219.1586433085724; Thu, 09 Apr 2020 04:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586433085; cv=none; d=google.com; s=arc-20160816; b=s6Q84VSGtOPKQl26rRoTAt/mRbETZh++dejnhm7aIpiiI1HAbHZkJWT8wrMrp0CyC7 WaKkKvq9uqM61NoVPjIYQdeHNS42OOvHJWa4kEdHAYFXhdjsFPEe1kjbVUrk6hrCPG2l 5Ii9zOGyK4WYwO4p8yBH/FrItiOcxd8ABezVhQOPx41j2faqRPYHeS80UMiG3/isXoV5 7ZbnGS8x61gELX24nNY8ggdFa7HwvRtICXWehaQTcW+prZ92v+Gdlto+w9OsbNNJWZ4m 6bPng9ddpQu9zUT0Z6hbYrzXZ5bJdGomjXkbF67kTD10dqOTlT3W8p6aRj5e4ooicriY Elxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=MOlvHl/QCsBwvft4LaTJNK728rPGD47CC5sTsHAjTkI=; b=xC5VA+8iTZtc2qoAu87tTAYxtRbPGIpzfdXqEKULXrXsB16MutXqiWlgXwB4nXMVOC ul3fUU6E+P+wMfQ/cife1T4CkkRMiS4svWvfEZdZxAJ7j/wpjEXYVnT7jXimX3Z95AJ3 UGi1gKx9N4vzrFmXebhutL7cUTeU677JrkD9rH5qb7YDOSRYoEDKT2fvV52MI3RwPJuT wfxTDKKEq/g2ZqlGRtxhx3rMOBuAueCXUMrJ0XqA+dQhhpQwM7ncGWRcFfGAowKyBqpx FtVc09H1pUxOCeVl99YgNhpaylsaQqkBas9Jen1f7Zm/N0weyZc5g0PCkK4d4gzL7us4 426g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ha8tTLiN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h27si5497541qkl.222.2020.04.09.04.51.10; Thu, 09 Apr 2020 04:51:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ha8tTLiN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbgDILsn (ORCPT + 99 others); Thu, 9 Apr 2020 07:48:43 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:45448 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726082AbgDILsn (ORCPT ); Thu, 9 Apr 2020 07:48:43 -0400 Received: by mail-io1-f67.google.com with SMTP id i19so3476184ioh.12; Thu, 09 Apr 2020 04:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MOlvHl/QCsBwvft4LaTJNK728rPGD47CC5sTsHAjTkI=; b=ha8tTLiN1nWPhSdpUxRrPNrKqZ8H87enea/Zm1U7cxzYt6AuA3NlzQWOg6XXbCHvIO LE2O17Nt8RkJf2KIeChDaPo0GYIA/liE/hfhU0V83QjAT9eYDkay1qy6MLsln8lFDbZ+ TaeYe9JPZJG+lPArQkzJ9GFTV3YMLKbfgGKK4BkDBtv0b1RPT+hvl23dkjjlUs8nO7kL I7XqCF3nNKSfMNKc9EwsZQeOI71r50wGcrrZE2AErIrivZsKdpz9zYV7YahSigzRFQig /jW+RILAk5aKSZWm4NJ5cHq0Pk46+bk2aOsx4jtFXp+pHFNapbTdHwBTmUP3ZbobWcMQ bSLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MOlvHl/QCsBwvft4LaTJNK728rPGD47CC5sTsHAjTkI=; b=lbs8OlJE5GEh7nW4IIX6Ry5o+AiO2SxXv+DvWDzFtKjcoAAg49s9JKN1B901ihlk0S cj2307DxhnL5FNgdNThjDeGAK8w0WIQMszS70GcbeOzxkTXfmr/OS2I5reGOhOITSrHx qu4k0uYZP5Cg1tRsxahMc4druD/xcgOnLfFdPnx0LKFNyGOHlrfT6kylI5rN1Ljhygz0 XvKZGTgWeSi8uPb35U8wYKPCOPDnMcw6hJvijGmFN4J2cAH/rbecU0kbTtlNxwkOJ/Hs 34sy+cPYP/4vyK3K04Ppl+WLXvrwDdwYenCg3F+ah9SW/c/r43b7B+f1cBk/cDzXUR7X Y8DQ== X-Gm-Message-State: AGi0Pua+3LNAUsQ1vzCnFjBgMc8ANFMpXv1amawn//YgKcIFFaUsBfbS 073UDJtPqhspUFeSItj8LJBpPwMqE/6K/FU92Kc= X-Received: by 2002:a6b:cd4a:: with SMTP id d71mr11544464iog.5.1586432922571; Thu, 09 Apr 2020 04:48:42 -0700 (PDT) MIME-Version: 1.0 References: <158642098777.5635.10501704178160375549.stgit@buzz> <67bdead3-a29f-a8af-5e7b-193a72cd4b86@yandex-team.ru> In-Reply-To: <67bdead3-a29f-a8af-5e7b-193a72cd4b86@yandex-team.ru> From: Amir Goldstein Date: Thu, 9 Apr 2020 14:48:31 +0300 Message-ID: Subject: Re: [PATCH] ovl: skip overlayfs superblocks at global sync To: Konstantin Khlebnikov Cc: linux-fsdevel , Miklos Szeredi , linux-kernel , Alexander Viro , overlayfs , Dmitry Monakhov , Linux Containers , Theodore Tso Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 9, 2020 at 2:28 PM Konstantin Khlebnikov wrote: > > On 09/04/2020 13.23, Amir Goldstein wrote: > > On Thu, Apr 9, 2020 at 11:30 AM Konstantin Khlebnikov > > wrote: > >> > >> Stacked filesystems like overlayfs has no own writeback, but they have to > >> forward syncfs() requests to backend for keeping data integrity. > >> > >> During global sync() each overlayfs instance calls method ->sync_fs() > >> for backend although it itself is in global list of superblocks too. > >> As a result one syscall sync() could write one superblock several times > >> and send multiple disk barriers. > >> > >> This patch adds flag SB_I_SKIP_SYNC into sb->sb_iflags to avoid that. > >> > >> Reported-by: Dmitry Monakhov > >> Signed-off-by: Konstantin Khlebnikov > >> --- > > > > Seems reasonable. > > You may add: > > Reviewed-by: Amir Goldstein > > > > +CC: containers list > > Thanks > > > > > This bring up old memories. > > I posted this way back to fix handling of emergency_remount() in the > > presence of loop mounted fs: > > https://lore.kernel.org/linux-ext4/CAA2m6vfatWKS1CQFpaRbii2AXiZFvQUjVvYhGxWTSpz+2rxDyg@mail.gmail.com/ > > > > But seems to me that emergency_sync() and sync(2) are equally broken > > for this use case. > > > > I wonder if anyone cares enough about resilience of loop mounted fs to try > > and change the iterate_* functions to iterate supers/bdevs in reverse order... > > Now I see reason behind "sync; sync; sync; reboot" =) > > Order old -> new allows to not miss new items if list modifies. > Might be important for some users. > That's not the reason I suggested reverse order. The reason is that with loop mounted fs, the correct order of flushing is: 1. sync loop mounted fs inodes => writes to loop image file 2. sync loop mounted fs sb => fsyncs the loop image file 3. sync the loop image host fs sb With forward sb iteration order, #3 happens before #1, so the loop mounted fs changes are not really being made durable by a single sync(2) call. > bdev iteration seems already reversed: inode_sb_list_add adds to the head > I think bdev iteration order will not make a difference in this case. flushing /dev/loopX will not be needed and it happens too late anyway. Thanks, Amir.