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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7BEAC433EF for ; Sat, 8 Jan 2022 08:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233850AbiAHIlo (ORCPT ); Sat, 8 Jan 2022 03:41:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31803 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233254AbiAHIlm (ORCPT ); Sat, 8 Jan 2022 03:41:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641631302; h=from:from:reply-to:subject:subject: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=A9IAN3xR9Cay5DTUAfbThKuQWTtiMNDV7nchjhETfU8=; b=Fek+KStXW0bRLozWJ77M1/8P+WqzUMQxNK321kdrJWMpnM0f7ZztLumhJNaK4JDvzw/T3C WMZSXuTw26RnV128dQtLmQRBlVvyC6w5ToRGMq13uYczIWW2EremRn0Hr/goCgK79JALpw N7eKmPFdgjsueAm4iV6Y7bKcdSJKQJ0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-N4TjadJYNBChUM06yBqS9g-1; Sat, 08 Jan 2022 03:41:39 -0500 X-MC-Unique: N4TjadJYNBChUM06yBqS9g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7036B18397A7; Sat, 8 Jan 2022 08:41:35 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.165]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA3CF5F92A; Sat, 8 Jan 2022 08:41:27 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <164021479106.640689.17404516570194656552.stgit@warthog.procyon.org.uk> <164021541207.640689.564689725898537127.stgit@warthog.procyon.org.uk> To: Amir Goldstein Cc: dhowells@redhat.com, linux-cachefs@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , Matthew Wilcox , Alexander Viro , Omar Sandoval , JeffleXu , Linus Torvalds , linux-afs@lists.infradead.org, Linux NFS Mailing List , CIFS , ceph-devel , v9fs-developer@lists.sourceforge.net, linux-fsdevel , linux-kernel Subject: Re: [PATCH v4 38/68] vfs, cachefiles: Mark a backing file in use with an inode flag MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3492170.1641631286.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Sat, 08 Jan 2022 08:41:26 +0000 Message-ID: <3492171.1641631286@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Amir Goldstein wrote: > > - if (is_local_mountpoint(dentry)) > > + if (is_local_mountpoint(dentry) || > > + (dentry->d_inode->i_flags & S_KERNEL_FILE)) > = > Better as this check to the many other checks in may_delete() Okay. It will make things a bit more complicated, so I'll do it in a foll= ow up patch. The problem is that it will prevent the cachefiles driver in th= e kernel from renaming directories and unlinking files as it's currently removing the mark *after* moving/deleting them. > > +#define S_KERNEL_FILE (1 << 17) /* File is in use by the kernel (eg.= fs/cachefiles) */ > > > = > Trying to brand this flag as a generic "in use by kernel" is misleading. > Modules other than cachefiles cannot set/clear this flag, because then > cachefiles won't know that it is allowed to set/clear the flag. If the flag is set, then cachefiles thinks some other kernel driver is usi= ng the file and it shouldn't try to use it. It doesn't matter who has it ope= n. It should never happen as other kernel drivers shouldn't be poking around inside cachefiles's cache, but possibly someone could misconfigure somethi= ng. David