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.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED 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 8BA52C10F14 for ; Tue, 23 Apr 2019 12:44:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE825206A3 for ; Tue, 23 Apr 2019 12:44:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AcQL9Oo+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726989AbfDWMoq (ORCPT ); Tue, 23 Apr 2019 08:44:46 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:33849 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726033AbfDWMoq (ORCPT ); Tue, 23 Apr 2019 08:44:46 -0400 Received: by mail-yw1-f66.google.com with SMTP id u14so3715504ywe.1; Tue, 23 Apr 2019 05:44:45 -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=+NvYrrrYGZdr4KXd/fhIRV1n+T6+FA3xGgdWCBrsfPc=; b=AcQL9Oo++NKw89V6zB+MIyMVOK7z9gqXLXgTIVpA735/5bZMl2Ytbv3rA5ztfLMK4B 152QCLUeuRs5XZaSVMbDqv0al0GnzAXZhVS+gN+pqgyVIKxR9WRuVxUydoL/xdgYx8mi jTbledsK42mXPy4KgKrrxDbVmZzkDTpYKAas7Owuba2sUsy8nGLBS/jlFfhg0db+8Lih RVQI+yK8EP0Pw03BtYX0cZ1nmtrEIjVVWw4l+rVXrxEYYY3LOXmAjS8P82w/8UYZ55Ik 7wqtJS8khmUUFRXLtSkB9pop9kcKLPGWHt6ADTBc/WOXa9jdTmM1MPfvYq6TrGWlwo3k 6xtQ== 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=+NvYrrrYGZdr4KXd/fhIRV1n+T6+FA3xGgdWCBrsfPc=; b=jv3keS7YrCd7tu99JrSAPlOx/M7krrqN29J1ACNxy8dnuUlLT0Vs3nseCvN7srbGwM oyRPX27gcw3aULXvOzX7FVr5zpq7aycv8EYqzoXI+2NcQZ3wNysm1Rm2UyThgPNtKqqP f4/4izVm09fBbQPDo8LlhXN3lgJftIm1vTogkaCPbXXH/lGhfzPjPwELQhB60NdnMY23 ulIAcnaYB17cvAIG95MsKzoZGAxI43mGseWwqg9hVOT+jwJqhx6EEqdHJV1lgbuO9IDw 17u6FdqLKJAmW/9U0tkKvnAOqvCoCe/BQmYj6waY9iajxAagKRRwB6JKOvfUALg9wUXG RaNQ== X-Gm-Message-State: APjAAAX/hQFhSzAUXpzOESh6Ow7HRLJRPTHytwVjoaCqA8YT2dejwnYc Jg9h+KVCQuNl/mL+SA0ggiKF5tgs8fqd1gUGMQ8eBtP8 X-Google-Smtp-Source: APXvYqxgSUV8ku2PA6rEgGu/mVN9S2JoK44GEKkOpCMr2tdq5OR0l2kO7ktwaMGIu0Z2U8jjOum2IDUqSVVAYhVrTpU= X-Received: by 2002:a81:7c4:: with SMTP id 187mr21594494ywh.176.1556023485145; Tue, 23 Apr 2019 05:44:45 -0700 (PDT) MIME-Version: 1.0 References: <20190423065024.12695-1-jencce.kernel@gmail.com> In-Reply-To: From: Amir Goldstein Date: Tue, 23 Apr 2019 15:44:33 +0300 Message-ID: Subject: Re: [PATCH] ovl: add RWF_NONITIFY flag to skip wrong duplicate fanotify event To: Miklos Szeredi 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 2:40 PM Miklos Szeredi wrote: > > 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. > Sigh! I figured there was a catch... Will it be ok if fake path used a cloned private mount of overlay mount? This will have averted the ignore mask problem. Users cannot set a mark on a private mount. Thanks, Amir.