From owner-freebsd-hackers@freebsd.org Thu Mar 9 00:15:38 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C84EED011F8 for ; Thu, 9 Mar 2017 00:15:38 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com [IPv6:2a00:1450:4010:c07::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DB921B3D for ; Thu, 9 Mar 2017 00:15:38 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: by mail-lf0-x22b.google.com with SMTP id j90so21549826lfk.2 for ; Wed, 08 Mar 2017 16:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AqojGE3+EtsQkQUbhKccl7/UHqDEwMgLLln+k5mMxtQ=; b=bcod/FxpLbR4ouBPNA/OsOhEqJlL2HPHegXj6TkYuUeG5oScQzi7P4wcdUpnnYe0V1 6Kh9c+5Bry2mAH2kBKxiXrjhIqKKsUITNGte9TxPqVyM3dD2ls0TvRSABTi4qV0wuTMq KjptQ+qD1Gfz1u1z4oXamLz4ihj3R0fsWMtUU3tCYvF/xVlnKJwKq6U5bZNJP8JvO+13 eYYEY3RccLtR9CqVlCux3vfbAjK/dm73BBCMo8a94d/5vvNDZBQbN7b44lvE9DNaybe0 yLOh/2RVo2aB56lUvdRsYa0V8Fxxrl8jRproYxejhFkJwVg9o+RomtaWVHHymfeY0ZoN mPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AqojGE3+EtsQkQUbhKccl7/UHqDEwMgLLln+k5mMxtQ=; b=lu0xYec2XAab+U9Z68ybrB93EJ5cnaZw4di6xtPAbBVCOvJ7fNSrgkgavkXSlYlqjQ XrnJLMf4hgllEy5nbfCN/sAQ5V+6/TsPnhL3hqtmzHFpIELJhBKIrNf6WZ+EQE4VLOQA RfNzsVmli3Dg0gt/mYGy+Gi+NTEriKXeNjqtR2JYtxycA3kmfwK2zstnhK7G/zsPTxUj lBsTZzhBQ2chnIR2JJPoqw6FzDGLd46lN2US4U8qQJmI0F3CvUX6g2jDi0MRxHTIoeit 6Vm0Ir9MowCJ4KgVkB/Y+KuisNhzKhU17jzfdd93gu54ZBcnxOK2HC+x2UST1blGhzZ8 BOzg== X-Gm-Message-State: AMke39mSf+sFQZsyYd4VgC8sTXuI97ar/Ut5V7cBxqcP12vuwlBy6EWmS3Q9E98BWmXN9w== X-Received: by 10.46.69.215 with SMTP id s206mr3073694lja.26.1489018535231; Wed, 08 Mar 2017 16:15:35 -0800 (PST) Received: from rimwks ([2001:470:28:81a:6ef0:49ff:fe75:38e3]) by smtp.gmail.com with ESMTPSA id p27sm935110lfg.5.2017.03.08.16.15.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Mar 2017 16:15:34 -0800 (PST) From: Rozhuk Ivan X-Google-Original-From: Rozhuk Ivan Date: Thu, 9 Mar 2017 03:15:32 +0300 To: Konstantin Belousov Cc: freebsd-hackers@freebsd.org Subject: Re: open(): O_EVTONLY and O_NOATIME Message-ID: <20170309031532.0079ab35@rimwks> In-Reply-To: <20170308235016.GT30979@kib.kiev.ua> References: <20170309022554.18875d07@rimwks> <20170308235016.GT30979@kib.kiev.ua> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Mar 2017 00:15:38 -0000 On Thu, 9 Mar 2017 01:50:16 +0200 Konstantin Belousov wrote: > > Can some one add O_EVTONLY and O_NOATIME to open()? > Sure, somebody can, but it might be that nobody will. > O_EVTONLY require knowledge about kqueue internals, I have not it. > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214338 > > devel/glib20: patch: new kqueue() backend for file monitoring > > > > Without O_NOATIME open() on file/dir always update attributes -> > > file browsing via sshfs/internet get very slow. Without O_EVTONLY > > kqueue() cant monitor dirs/files than locked, also this cause > > unmount proublems. > What do you mean by 'cannot monitor files that are locked' ? In > particular, what user-settable locks (advisory locks ?) prevent > kqueue(2) event reporting ? If some one already open and lock dir/file you can not open it. > > IMHO O_NOATIME - easy to add. > > Hmm. There is an architectural question about allowing user to > override the administrator mounting option. If the system > configuration mounted the volume without noatime mount option, then > why should we allow user to escape the policy ? In particular, access > times might provide some important information WRT undesirable > incidents, esp. on sealed machines. > > We might add a new mount option, which would not disable atime, but > allow user to request O_NOATIME behaviour. E.g., it could be > specified for the monitored volumes on desktops, if I follow your use > case. > May be we should do like other OS that already have O_NOATIME? > That said, I see two practical troubles with implementation: > > 1. The atime update is filesystem-specific, i.e. you must teach each > filesystem how to react to the flag. At least, UFS, ZFS, msdosfs and > tmpfs must be adapted. > > 2. If you look at any of the filesystems in the list of the #1, you > would note that atime is set in the context which already lost any > reference to the file which initiated the operation. For instance, > consider the most often cause for atime update, read(2): VFS > translates the syscall through all its layers into VOP_READ() call > for fs-specific action, and the signature of the call is > VOP_READ(struct vnode *, struct uio *, int ioflag, struct > ucred *); As you see, there file is already down-casted to vnode, and > of course we do not want the vnode to loose atime updates just > because one file is opened which asked for no atime updates. As > result, upper VFS layers must pass a flag to VOP_READ(). > > You are welcome to finish the analysis and to prototype the solution. ???? If file system cant be mount with NOATIME - then it already ready to support O_NOATIME.