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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E81B8C10F14 for ; Tue, 23 Apr 2019 11:40:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BB2B21738 for ; Tue, 23 Apr 2019 11:40:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="GKOzORst" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727522AbfDWLkB (ORCPT ); Tue, 23 Apr 2019 07:40:01 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:46965 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727467AbfDWLkA (ORCPT ); Tue, 23 Apr 2019 07:40:00 -0400 Received: by mail-io1-f68.google.com with SMTP id p23so12216179iol.13 for ; Tue, 23 Apr 2019 04:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rad426uNfNAkPMlWYhgWpc5zn5BN55I4rUemNJiRebI=; b=GKOzORstXK/Gj4Ai4GN1OCyYuz4RXWoeF2gnQly3No3XwIjTxzGE8wJAQKYCmA+G+N e0r56B5qaJFyn24Uof4SYVrv6dApcP2pz/hgdXvSZ9xEc4iRuCqd91DN19Aue5DLrWD9 20uChxyrxv8+71WY3mLNHlwuGLVi+d3C32h1s= 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=rad426uNfNAkPMlWYhgWpc5zn5BN55I4rUemNJiRebI=; b=oPGkHm2N1H1ZeWoH8nbfL9rGEqDYmWKfOK7MadjIwtBaaTCifGUTweluSWvm8+ohyr xRNghGm0BIz0XJ4z02dga9LK4JDFGEQOOgrkxf+2CZHC11Ue3MpJ1yq2yp/63uRQs9Gp KpO0yFb7i4pLZDKDbLv28Ns2OHtbAYXFcZQhMoojIXl0d/Z5SM/ZiOdMHdRvZ6EEhnpR 8FcgJ0hO6qtflz2L2mhM1E1agMFmZR/R+i/pvob25NEcTYQ4tcTX6GyhS6dbF7yqjKZL b6aBAhmN/XhDqpHzETjp2iKp7Fprg2gdiMsCTUkDCVu4P8DtlSwSAOk7GQezj7HDYLsS EBjw== X-Gm-Message-State: APjAAAVG9tkfwthN7vcRTNMkS1aNDDEQvK48Yj6QczP7RM+ZpIeEj78O IY6EnE6ak7VKZBscaKZXhlTFKYRLZbaiGsIZEaECjQ== X-Google-Smtp-Source: APXvYqzgKOUK3i3U8MGccrNS2faFet5pGtcqSxVPWZ+GwDisczipzrzdx9nzduFEzDnTYOh5xhY42HpqGVmrIz9rfQY= X-Received: by 2002:a6b:6006:: with SMTP id r6mr3207527iog.294.1556019599744; Tue, 23 Apr 2019 04:39:59 -0700 (PDT) MIME-Version: 1.0 References: <20190423065024.12695-1-jencce.kernel@gmail.com> In-Reply-To: From: Miklos Szeredi Date: Tue, 23 Apr 2019 13:39:48 +0200 Message-ID: Subject: Re: [PATCH] ovl: add RWF_NONITIFY flag to skip wrong duplicate fanotify event To: Amir Goldstein Cc: Murphy Zhou , overlayfs , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, Apr 23, 2019 at 1:00 PM Amir Goldstein wrote: > > On Tue, Apr 23, 2019 at 9:51 AM Murphy Zhou wrote: > > > > Overlays ovl_iter_write calls vfs_iter_write to write on real file, > > in which calls fsnotify_modify on this change, however vfs_write also > > calls fsnotify_modify after ovl_iter_write. The first notification > > sent by vfs_iter_write grabs marks from upper inode and overlay mnt, > > because of its fake path. The second one sent by vfs_write grabs marks > > from ovl inode and ovl mnt. > > > > LTP fanotify06 add modify mark for mnt point, then add ignore modify > > mask on testfile, then truncate and write the file. Because the ignore > > mask is marked on ovl inode, not the upper inode, the first event is not > > masked like the second one. So we get a modification event even with a > > mask on the file. > > Care to extend fanotify06 in a similar manner to the way readahead02 > was extended to test overlay test case regardless of the base LTP filesystem? > > > > > Proposing fixing this by add a new RWF flag to skip fsnotify on this IO. > > vfs_iter_write used by ovl can use this flag to skip one duplicate event. > > > > This fix is wrong for several reasons: > - It exports RWF_NONOTIFY to uapi > - It will cause no events at all when overlay writes to file even when user > requested events on upper inode > > Please try attached patch. Would be nice, but until mmap stops using realfile this isn't a good solution. Thanks, Miklos