From nobody Mon Jun 29 23:19:59 2026 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 68722C4332F for ; Mon, 31 Jan 2022 15:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350610AbiAaPNv (ORCPT ); Mon, 31 Jan 2022 10:13:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57612 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376969AbiAaPNt (ORCPT ); Mon, 31 Jan 2022 10:13:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643642029; 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=QwoHxxoKlCQMj44Cw8LJFgPBGh2dAnuJJL1xy+5OlKc=; b=S2UpeTl6DFHPwrxiu3kRJHsiyp9SOBVIZtcGHaoaAqtz6C6ClzYJRR5Z/I3YiwkXmZmgry 9I4Snt1x7wKd02oq4Z1rwlkXPVmEx9TaqgBWsO/XUcL2jCS2bx16G8v5L7elXjDhbpfWyE ab94zEqvJRBMOqUpy4Tb1uhJxshgKnw= 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-650-YHXe1yW0Pu-u8-siX9ozUg-1; Mon, 31 Jan 2022 10:13:40 -0500 X-MC-Unique: YHXe1yW0Pu-u8-siX9ozUg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B0B593925; Mon, 31 Jan 2022 15:13:38 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6594374E8D; Mon, 31 Jan 2022 15:12:57 +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 Subject: [PATCH 1/5] vfs, overlayfs, cachefiles: Turn I_OVL_INUSE into something generic From: David Howells To: Amir Goldstein Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, dhowells@redhat.com, Christoph Hellwig , Miklos Szeredi , Jeff Layton , Alexander Viro , torvalds@linux-foundation.org, linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Jan 2022 15:12:56 +0000 Message-ID: <164364197646.1476539.3635698398603811895.stgit@warthog.procyon.org.uk> In-Reply-To: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> References: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Turn overlayfs's I_OVL_INUSE into something generic that cachefiles can also use for excluding access to its own cache files by renaming it to I_EXCL_INUSE as suggested by Amir[1] and hoisting the helpers to generic code. Suggested-by: Amir Goldstein Signed-off-by: David Howells cc: Amir Goldstein cc: Miklos Szeredi cc: linux-unionfs@vger.kernel.org cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/CAOQ4uxhRS3MGEnCUDcsB1RL0d1Oy0g0Rzm75hVFAJw= 2dJ7uKSA@mail.gmail.com/ [1] --- fs/inode.c | 43 +++++++++++++++++++++++++++++++++++++++++++ fs/overlayfs/overlayfs.h | 3 --- fs/overlayfs/super.c | 12 ++++++------ fs/overlayfs/util.c | 43 ------------------------------------------- include/linux/fs.h | 22 +++++++++++++++++++--- 5 files changed, 68 insertions(+), 55 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 63324df6fa27..954719f66113 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2405,3 +2405,46 @@ struct timespec64 current_time(struct inode *inode) return timestamp_truncate(now, inode); } EXPORT_SYMBOL(current_time); + +/** + * inode_excl_inuse_trylock - Try to exclusively lock an inode for kernel = access + * @dentry: Reference to the inode to be locked + * + * Try to gain exclusive access to an inode for a kernel service, returning + * true if successful. + */ +bool inode_excl_inuse_trylock(struct dentry *dentry) +{ + struct inode *inode =3D d_inode(dentry); + bool locked =3D false; + + spin_lock(&inode->i_lock); + if (!(inode->i_state & I_EXCL_INUSE)) { + inode->i_state |=3D I_EXCL_INUSE; + locked =3D true; + } + spin_unlock(&inode->i_lock); + + return locked; +} +EXPORT_SYMBOL(inode_excl_inuse_trylock); + +/** + * inode_excl_inuse_unlock - Unlock exclusive kernel access to an inode + * @dentry: Reference to the inode to be unlocked + * + * Drop exclusive access to an inode for a kernel service. A warning is g= iven + * if the inode was not marked for exclusive access. + */ +void inode_excl_inuse_unlock(struct dentry *dentry) +{ + if (dentry) { + struct inode *inode =3D d_inode(dentry); + + spin_lock(&inode->i_lock); + WARN_ON(!(inode->i_state & I_EXCL_INUSE)); + inode->i_state &=3D ~I_EXCL_INUSE; + spin_unlock(&inode->i_lock); + } +} +EXPORT_SYMBOL(inode_excl_inuse_unlock); diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 2cd5741c873b..8415c0c6d40c 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -337,9 +337,6 @@ int ovl_check_setxattr(struct ovl_fs *ofs, struct dentr= y *upperdentry, enum ovl_xattr ox, const void *value, size_t size, int xerr); int ovl_set_impure(struct dentry *dentry, struct dentry *upperdentry); -bool ovl_inuse_trylock(struct dentry *dentry); -void ovl_inuse_unlock(struct dentry *dentry); -bool ovl_is_inuse(struct dentry *dentry); bool ovl_need_index(struct dentry *dentry); int ovl_nlink_start(struct dentry *dentry); void ovl_nlink_end(struct dentry *dentry); diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 7bb0a47cb615..5c3361a2dc7c 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -224,10 +224,10 @@ static void ovl_free_fs(struct ovl_fs *ofs) dput(ofs->indexdir); dput(ofs->workdir); if (ofs->workdir_locked) - ovl_inuse_unlock(ofs->workbasedir); + inode_excl_inuse_unlock(ofs->workbasedir); dput(ofs->workbasedir); if (ofs->upperdir_locked) - ovl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root); + inode_excl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root); =20 /* Hack! Reuse ofs->layers as a vfsmount array before freeing it */ mounts =3D (struct vfsmount **) ofs->layers; @@ -1239,7 +1239,7 @@ static int ovl_get_upper(struct super_block *sb, stru= ct ovl_fs *ofs, if (upper_mnt->mnt_sb->s_flags & SB_NOSEC) sb->s_flags |=3D SB_NOSEC; =20 - if (ovl_inuse_trylock(ovl_upper_mnt(ofs)->mnt_root)) { + if (inode_excl_inuse_trylock(ovl_upper_mnt(ofs)->mnt_root)) { ofs->upperdir_locked =3D true; } else { err =3D ovl_report_in_use(ofs, "upperdir"); @@ -1499,7 +1499,7 @@ static int ovl_get_workdir(struct super_block *sb, st= ruct ovl_fs *ofs, =20 ofs->workbasedir =3D dget(workpath.dentry); =20 - if (ovl_inuse_trylock(ofs->workbasedir)) { + if (inode_excl_inuse_trylock(ofs->workbasedir)) { ofs->workdir_locked =3D true; } else { err =3D ovl_report_in_use(ofs, "workdir"); @@ -1722,7 +1722,7 @@ static int ovl_get_layers(struct super_block *sb, str= uct ovl_fs *ofs, if (err) goto out; =20 - if (ovl_is_inuse(stack[i].dentry)) { + if (inode_is_excl_inuse(stack[i].dentry)) { err =3D ovl_report_in_use(ofs, "lowerdir"); if (err) { iput(trap); @@ -1872,7 +1872,7 @@ static int ovl_check_layer(struct super_block *sb, st= ruct ovl_fs *ofs, if (is_lower && ovl_lookup_trap_inode(sb, parent)) { err =3D -ELOOP; pr_err("overlapping %s path\n", name); - } else if (ovl_is_inuse(parent)) { + } else if (inode_is_excl_inuse(parent)) { err =3D ovl_report_in_use(ofs, name); } next =3D parent; diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index f48284a2a896..748c4b22deb3 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -724,49 +724,6 @@ int ovl_set_protattr(struct inode *inode, struct dentr= y *upper, return 0; } =20 -/** - * Caller must hold a reference to inode to prevent it from being freed wh= ile - * it is marked inuse. - */ -bool ovl_inuse_trylock(struct dentry *dentry) -{ - struct inode *inode =3D d_inode(dentry); - bool locked =3D false; - - spin_lock(&inode->i_lock); - if (!(inode->i_state & I_OVL_INUSE)) { - inode->i_state |=3D I_OVL_INUSE; - locked =3D true; - } - spin_unlock(&inode->i_lock); - - return locked; -} - -void ovl_inuse_unlock(struct dentry *dentry) -{ - if (dentry) { - struct inode *inode =3D d_inode(dentry); - - spin_lock(&inode->i_lock); - WARN_ON(!(inode->i_state & I_OVL_INUSE)); - inode->i_state &=3D ~I_OVL_INUSE; - spin_unlock(&inode->i_lock); - } -} - -bool ovl_is_inuse(struct dentry *dentry) -{ - struct inode *inode =3D d_inode(dentry); - bool inuse; - - spin_lock(&inode->i_lock); - inuse =3D (inode->i_state & I_OVL_INUSE); - spin_unlock(&inode->i_lock); - - return inuse; -} - /* * Does this overlay dentry need to be indexed on copy up? */ diff --git a/include/linux/fs.h b/include/linux/fs.h index f3daaea16554..4c15e270f1ac 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2320,8 +2320,10 @@ static inline void kiocb_clone(struct kiocb *kiocb, = struct kiocb *kiocb_src, * wb stat updates to grab the i_pages lock. See * inode_switch_wbs_work_fn() for details. * - * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper - * and work dirs among overlayfs mounts. + * I_EXCL_INUSE Marked for exclusive use by a kernel service. Used by + * overlayfs to get exclusive ownership on upper and work + * dirs among overlayfs mounts and by cachefiles to prevent + * multiple access to a cache file. * * I_CREATING New object's inode in the middle of setting up. * @@ -2351,7 +2353,7 @@ static inline void kiocb_clone(struct kiocb *kiocb, s= truct kiocb *kiocb_src, #define I_LINKABLE (1 << 10) #define I_DIRTY_TIME (1 << 11) #define I_WB_SWITCH (1 << 13) -#define I_OVL_INUSE (1 << 14) +#define I_EXCL_INUSE (1 << 14) #define I_CREATING (1 << 15) #define I_DONTCACHE (1 << 16) #define I_SYNC_QUEUED (1 << 17) @@ -2387,6 +2389,20 @@ static inline bool inode_is_dirtytime_only(struct in= ode *inode) I_FREEING | I_WILL_FREE)) =3D=3D I_DIRTY_TIME; } =20 +bool inode_excl_inuse_trylock(struct dentry *dentry); +void inode_excl_inuse_unlock(struct dentry *dentry); + +static inline bool inode_is_excl_inuse(struct dentry *dentry) +{ + struct inode *inode =3D d_inode(dentry); + bool inuse; + + spin_lock(&inode->i_lock); + inuse =3D (inode->i_state & I_EXCL_INUSE); + spin_unlock(&inode->i_lock); + return inuse; +} + extern void inc_nlink(struct inode *inode); extern void drop_nlink(struct inode *inode); extern void clear_nlink(struct inode *inode); From nobody Mon Jun 29 23:19:59 2026 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 835F7C433F5 for ; Mon, 31 Jan 2022 15:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377287AbiAaPOB (ORCPT ); Mon, 31 Jan 2022 10:14:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22111 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376969AbiAaPNw (ORCPT ); Mon, 31 Jan 2022 10:13:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643642032; 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=WNY27SrxhFfcwywq83/THIY3BfDtPTJRz689v8YiT4I=; b=MT/UVdjkczb3b2kfvH+QP3lMN2Rsygg7x5FSejNtSiLXUddWO0gtbJvOmHMWPXxx6pOUFW OodCC2AJPcElsLwldL9GLrP+mv3GbU3IEjvOa1dSg44gQ9PEbVrpyvKg+1+edUIkf80TZ0 kSZ4TGzMH7IFRvr8JwIPaW9GJFhiMV8= 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-148-t4OMMK1zNEC5MGQtsuW1Xw-1; Mon, 31 Jan 2022 10:13:48 -0500 X-MC-Unique: t4OMMK1zNEC5MGQtsuW1Xw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B50351006AA7; Mon, 31 Jan 2022 15:13:46 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F97970F60; Mon, 31 Jan 2022 15:13:44 +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 Subject: [PATCH 2/5] vfs: Add tracepoints for inode_excl_inuse_trylock/unlock From: David Howells To: Amir Goldstein Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, dhowells@redhat.com, Christoph Hellwig , Miklos Szeredi , Jeff Layton , Alexander Viro , torvalds@linux-foundation.org, linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Jan 2022 15:13:43 +0000 Message-ID: <164364202369.1476539.452557132083658522.stgit@warthog.procyon.org.uk> In-Reply-To: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> References: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add tracepoints for inode_excl_inuse_trylock/unlock() to record successful and lock, failed lock, successful unlock and unlock when it wasn't locked. Signed-off-by: David Howells cc: Amir Goldstein cc: Miklos Szeredi cc: linux-unionfs@vger.kernel.org cc: linux-cachefs@redhat.com --- fs/inode.c | 21 +++++++++++++++++---- fs/overlayfs/super.c | 10 ++++++---- include/linux/fs.h | 9 +++++++-- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 954719f66113..61b93a89853f 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -22,6 +22,8 @@ #include #include #include "internal.h" +#define CREATE_TRACE_POINTS +#include =20 /* * Inode locking rules: @@ -2409,11 +2411,14 @@ EXPORT_SYMBOL(current_time); /** * inode_excl_inuse_trylock - Try to exclusively lock an inode for kernel = access * @dentry: Reference to the inode to be locked + * @o: Private reference for the kernel service + * @who: Which kernel service is trying to gain the lock * * Try to gain exclusive access to an inode for a kernel service, returning * true if successful. */ -bool inode_excl_inuse_trylock(struct dentry *dentry) +bool inode_excl_inuse_trylock(struct dentry *dentry, unsigned int o, + enum inode_excl_inuse_by who) { struct inode *inode =3D d_inode(dentry); bool locked =3D false; @@ -2421,7 +2426,10 @@ bool inode_excl_inuse_trylock(struct dentry *dentry) spin_lock(&inode->i_lock); if (!(inode->i_state & I_EXCL_INUSE)) { inode->i_state |=3D I_EXCL_INUSE; + trace_inode_excl_inuse_lock(inode, o, who); locked =3D true; + } else { + trace_inode_excl_inuse_lock_failed(inode, o, who); } spin_unlock(&inode->i_lock); =20 @@ -2432,18 +2440,23 @@ EXPORT_SYMBOL(inode_excl_inuse_trylock); /** * inode_excl_inuse_unlock - Unlock exclusive kernel access to an inode * @dentry: Reference to the inode to be unlocked + * @o: Private reference for the kernel service * * Drop exclusive access to an inode for a kernel service. A warning is g= iven * if the inode was not marked for exclusive access. */ -void inode_excl_inuse_unlock(struct dentry *dentry) +void inode_excl_inuse_unlock(struct dentry *dentry, unsigned int o) { if (dentry) { struct inode *inode =3D d_inode(dentry); =20 spin_lock(&inode->i_lock); - WARN_ON(!(inode->i_state & I_EXCL_INUSE)); - inode->i_state &=3D ~I_EXCL_INUSE; + if (WARN_ON(!(inode->i_state & I_EXCL_INUSE))) { + trace_inode_excl_inuse_unlock_bad(inode, o); + } else { + inode->i_state &=3D ~I_EXCL_INUSE; + trace_inode_excl_inuse_unlock(inode, o); + } spin_unlock(&inode->i_lock); } } diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 5c3361a2dc7c..6434ae11496d 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -224,10 +224,10 @@ static void ovl_free_fs(struct ovl_fs *ofs) dput(ofs->indexdir); dput(ofs->workdir); if (ofs->workdir_locked) - inode_excl_inuse_unlock(ofs->workbasedir); + inode_excl_inuse_unlock(ofs->workbasedir, 0); dput(ofs->workbasedir); if (ofs->upperdir_locked) - inode_excl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root); + inode_excl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root, 0); =20 /* Hack! Reuse ofs->layers as a vfsmount array before freeing it */ mounts =3D (struct vfsmount **) ofs->layers; @@ -1239,7 +1239,8 @@ static int ovl_get_upper(struct super_block *sb, stru= ct ovl_fs *ofs, if (upper_mnt->mnt_sb->s_flags & SB_NOSEC) sb->s_flags |=3D SB_NOSEC; =20 - if (inode_excl_inuse_trylock(ovl_upper_mnt(ofs)->mnt_root)) { + if (inode_excl_inuse_trylock(ovl_upper_mnt(ofs)->mnt_root, 0, + inode_excl_inuse_by_overlayfs)) { ofs->upperdir_locked =3D true; } else { err =3D ovl_report_in_use(ofs, "upperdir"); @@ -1499,7 +1500,8 @@ static int ovl_get_workdir(struct super_block *sb, st= ruct ovl_fs *ofs, =20 ofs->workbasedir =3D dget(workpath.dentry); =20 - if (inode_excl_inuse_trylock(ofs->workbasedir)) { + if (inode_excl_inuse_trylock(ofs->workbasedir, 0, + inode_excl_inuse_by_overlayfs)) { ofs->workdir_locked =3D true; } else { err =3D ovl_report_in_use(ofs, "workdir"); diff --git a/include/linux/fs.h b/include/linux/fs.h index 4c15e270f1ac..f461883d66a8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2389,8 +2389,13 @@ static inline bool inode_is_dirtytime_only(struct in= ode *inode) I_FREEING | I_WILL_FREE)) =3D=3D I_DIRTY_TIME; } =20 -bool inode_excl_inuse_trylock(struct dentry *dentry); -void inode_excl_inuse_unlock(struct dentry *dentry); +enum inode_excl_inuse_by { + inode_excl_inuse_by_overlayfs, +}; + +bool inode_excl_inuse_trylock(struct dentry *dentry, unsigned int o, + enum inode_excl_inuse_by who); +void inode_excl_inuse_unlock(struct dentry *dentry, unsigned int o); =20 static inline bool inode_is_excl_inuse(struct dentry *dentry) { From nobody Mon Jun 29 23:19:59 2026 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 22857C433EF for ; Mon, 31 Jan 2022 15:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378694AbiAaPOZ (ORCPT ); Mon, 31 Jan 2022 10:14:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26103 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349362AbiAaPOC (ORCPT ); Mon, 31 Jan 2022 10:14:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643642042; 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=EChROvVWApPD5IL1/KUVjhhwa4UKblZNA+CDchoZCYw=; b=VESbLIXecCP6jh/5W+Ga0WPpsm+rjISENC1A/AlE96IWW+hgdn3vpybR8DqcRmbIUq1EyA /WFAV0O+8IK0LMzaceif1ilrcnhRNnjXoX4N+nvspcNSPsp8w4g3MD1w8SJmjGNuprCPZ7 OjGj9rA8RdLGlidwyA+eEPbHeg95Lxo= 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-592-o_cR7Fo0OwyMbodcPQz2gg-1; Mon, 31 Jan 2022 10:13:56 -0500 X-MC-Unique: o_cR7Fo0OwyMbodcPQz2gg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 041DC8519E0; Mon, 31 Jan 2022 15:13:55 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id D72C774EB9; Mon, 31 Jan 2022 15:13:52 +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 Subject: [PATCH 3/5] cachefiles: Split removal-prevention from S_KERNEL_FILE and extend effects From: David Howells To: Amir Goldstein Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, dhowells@redhat.com, Christoph Hellwig , Miklos Szeredi , Jeff Layton , Alexander Viro , torvalds@linux-foundation.org, linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Jan 2022 15:13:52 +0000 Message-ID: <164364203196.1476539.12557909603374068848.stgit@warthog.procyon.org.uk> In-Reply-To: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> References: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split removal-prevention from the S_KERNEL_FILE flag as it's really a separate job and it should affect unlnk and rename too, not just rmdir[1]. This new flag is called I_NO_REMOVE and moved to inode->i_state. If this is set, the file or directory may not be removed, renamed or unlinked. This can then be used by cachefiles to prevent userspace removing or renaming files and directories that the are being used. It could also be used by overlayfs to prevent fiddling in its work directories. The directory layout in its cache is very important to cachefiles as the names are how it indexes the contents. Removing objects can cause cachefilesd to malfunction as it may find it can't reach bits of the structure that it previously created and still has dentry pointers to. This also closes a race between cachefilesd trying to cull an empty directory and cachefiles trying to create something in it. Amir Goldstein suggested that the check in vfs_rmdir() should be moved to may_delete()[1], but it really needs to be done whilst the inode lock is held. I_NO_REMOVE should only be test/set/cleared under the inode lock without the lock being dropped between that and the VFS operations that might be affected by it lest races occur. Note also that I_NO_REMOVE will prevent vfs_unlink() vfs_rmdir() and vfs_rename() from operating on a file. Signed-off-by: David Howells cc: Amir Goldstein cc: Miklos Szeredi cc: linux-unionfs@vger.kernel.org cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/CAOQ4uxjEcvffv=3DrNXS-r+NLz+=3D6yk4abRuX_AM= q9v-M4nf_PtA@mail.gmail.com [1] --- fs/cachefiles/namei.c | 12 ++++++++++-- fs/namei.c | 8 +++++--- include/linux/fs.h | 4 ++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index f256c8aff7bb..8930c767d93a 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -20,8 +20,10 @@ static bool __cachefiles_mark_inode_in_use(struct cachef= iles_object *object, struct inode *inode =3D d_backing_inode(dentry); bool can_use =3D false; =20 + spin_lock(&inode->i_lock); if (!(inode->i_flags & S_KERNEL_FILE)) { inode->i_flags |=3D S_KERNEL_FILE; + inode->i_state |=3D I_NO_REMOVE; trace_cachefiles_mark_active(object, inode); can_use =3D true; } else { @@ -29,6 +31,7 @@ static bool __cachefiles_mark_inode_in_use(struct cachefi= les_object *object, pr_notice("cachefiles: Inode already in use: %pd (B=3D%lx)\n", dentry, inode->i_ino); } + spin_unlock(&inode->i_lock); =20 return can_use; } @@ -53,7 +56,10 @@ static void __cachefiles_unmark_inode_in_use(struct cach= efiles_object *object, { struct inode *inode =3D d_backing_inode(dentry); =20 + spin_lock(&inode->i_lock); inode->i_flags &=3D ~S_KERNEL_FILE; + inode->i_state &=3D ~I_NO_REMOVE; + spin_unlock(&inode->i_lock); trace_cachefiles_mark_inactive(object, inode); } =20 @@ -392,8 +398,10 @@ int cachefiles_bury_object(struct cachefiles_cache *ca= che, }; trace_cachefiles_rename(object, d_inode(rep)->i_ino, why); ret =3D cachefiles_inject_read_error(); - if (ret =3D=3D 0) + if (ret =3D=3D 0) { + __cachefiles_unmark_inode_in_use(object, rep); ret =3D vfs_rename(&rd); + } if (ret !=3D 0) trace_cachefiles_vfs_error(object, d_inode(dir), ret, cachefiles_trace_rename_error); @@ -402,7 +410,6 @@ int cachefiles_bury_object(struct cachefiles_cache *cac= he, "Rename failed with error %d", ret); } =20 - __cachefiles_unmark_inode_in_use(object, rep); unlock_rename(cache->graveyard, dir); dput(grave); _leave(" =3D 0"); @@ -426,6 +433,7 @@ int cachefiles_delete_object(struct cachefiles_object *= object, dget(dentry); =20 inode_lock_nested(d_backing_inode(fan), I_MUTEX_PARENT); + cachefiles_unmark_inode_in_use(object, object->file); ret =3D cachefiles_unlink(volume->cache, object, fan, dentry, why); inode_unlock(d_backing_inode(fan)); dput(dentry); diff --git a/fs/namei.c b/fs/namei.c index 3f1829b3ab5b..ea17377794d3 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4009,7 +4009,7 @@ int vfs_rmdir(struct user_namespace *mnt_userns, stru= ct inode *dir, =20 error =3D -EBUSY; if (is_local_mountpoint(dentry) || - (dentry->d_inode->i_flags & S_KERNEL_FILE)) + (dentry->d_inode->i_flags & I_NO_REMOVE)) goto out; =20 error =3D security_inode_rmdir(dir, dentry); @@ -4139,7 +4139,8 @@ int vfs_unlink(struct user_namespace *mnt_userns, str= uct inode *dir, inode_lock(target); if (IS_SWAPFILE(target)) error =3D -EPERM; - else if (is_local_mountpoint(dentry)) + else if (is_local_mountpoint(dentry) || + (dentry->d_inode->i_flags & I_NO_REMOVE)) error =3D -EBUSY; else { error =3D security_inode_unlink(dir, dentry); @@ -4653,7 +4654,8 @@ int vfs_rename(struct renamedata *rd) goto out; =20 error =3D -EBUSY; - if (is_local_mountpoint(old_dentry) || is_local_mountpoint(new_dentry)) + if (is_local_mountpoint(old_dentry) || is_local_mountpoint(new_dentry) || + (old_dentry->d_inode->i_flags & I_NO_REMOVE)) goto out; =20 if (max_links && new_dir !=3D old_dir) { diff --git a/include/linux/fs.h b/include/linux/fs.h index f461883d66a8..a273d5cde731 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2332,6 +2332,9 @@ static inline void kiocb_clone(struct kiocb *kiocb, s= truct kiocb *kiocb_src, * I_SYNC_QUEUED Inode is queued in b_io or b_more_io writeback lists. * Used to detect that mark_inode_dirty() should not move * inode between dirty lists. + * I_NO_REMOVE Unlink, rmdir and rename are not allowed to remove the + * object or any of its hard links. + * * * I_PINNING_FSCACHE_WB Inode is pinning an fscache object for writeback. * @@ -2358,6 +2361,7 @@ static inline void kiocb_clone(struct kiocb *kiocb, s= truct kiocb *kiocb_src, #define I_DONTCACHE (1 << 16) #define I_SYNC_QUEUED (1 << 17) #define I_PINNING_FSCACHE_WB (1 << 18) +#define I_NO_REMOVE (1 << 19) =20 #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES) From nobody Mon Jun 29 23:19:59 2026 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 643CFC433FE for ; Mon, 31 Jan 2022 15:15:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379423AbiAaPPI (ORCPT ); Mon, 31 Jan 2022 10:15:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40640 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377843AbiAaPOO (ORCPT ); Mon, 31 Jan 2022 10:14:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643642048; 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=5gBtosB0UfmfYr5zZy3baE9jgYgCk/escq5rx8anoDY=; b=YAWLtUaEedxK2uVbMem5PFUFCBR2vWtddzUfecQO0rqNyFEHU7IZgY1H8NBwqJm54rzdV7 cxhNoeW8x19pM+MjVvySwptDQpiGGVUeySK8wlNmCdxc0+Js3U1BTlhFqu1iyvo6zzZixZ rLepBct50CwCKOBvJCEjes7sGLd2Z+s= 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-428-spLipaAGOEWk4R9t29eT7g-1; Mon, 31 Jan 2022 10:14:04 -0500 X-MC-Unique: spLipaAGOEWk4R9t29eT7g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5993418C89C4; Mon, 31 Jan 2022 15:14:03 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39D117243D; Mon, 31 Jan 2022 15:14:01 +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 Subject: [PATCH 4/5] cachefiles: Use I_EXCL_INUSE instead of S_KERNEL_FILE From: David Howells To: Amir Goldstein Cc: Miklos Szeredi , linux-cachefs@redhat.com, linux-unionfs@vger.kernel.org, dhowells@redhat.com, Christoph Hellwig , Miklos Szeredi , Jeff Layton , Alexander Viro , torvalds@linux-foundation.org, linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Jan 2022 15:14:00 +0000 Message-ID: <164364204024.1476539.3811417846576668364.stgit@warthog.procyon.org.uk> In-Reply-To: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> References: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get rid of S_KERNEL_FILE and use I_EXCL_INUSE instead, thereby sharing that flag with overlayfs. This is used by cachefiles for two purposes: firstly, to prevent simultaneous access to a backing file, which could cause data corruption, and secondly, to allow cachefilesd to find out if it's allowed to cull a backing file without having to have duplicate lookup infrastructure (the VFS already has all the infrastructure that is necessary to do the lookup; cachefiles just needs a single bit flag). Signed-off-by: David Howells cc: Amir Goldstein cc: Miklos Szeredi cc: linux-cachefs@redhat.com cc: linux-unionfs@vger.kernel.org Link: https://lore.kernel.org/r/CAOQ4uxhRS3MGEnCUDcsB1RL0d1Oy0g0Rzm75hVFAJw= 2dJ7uKSA@mail.gmail.com/ [1] --- fs/cachefiles/namei.c | 46 ++++++++++++++++++++-------------------------- include/linux/fs.h | 2 +- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 8930c767d93a..0c88c82c188f 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -18,22 +18,19 @@ static bool __cachefiles_mark_inode_in_use(struct cache= files_object *object, struct dentry *dentry) { struct inode *inode =3D d_backing_inode(dentry); - bool can_use =3D false; + bool locked; =20 - spin_lock(&inode->i_lock); - if (!(inode->i_flags & S_KERNEL_FILE)) { - inode->i_flags |=3D S_KERNEL_FILE; + locked =3D inode_excl_inuse_trylock(dentry, object ? object->debug_id : 0, + inode_excl_inuse_by_cachefiles); + if (locked) { + spin_lock(&inode->i_lock); inode->i_state |=3D I_NO_REMOVE; - trace_cachefiles_mark_active(object, inode); - can_use =3D true; + spin_unlock(&inode->i_lock); } else { - trace_cachefiles_mark_failed(object, inode); pr_notice("cachefiles: Inode already in use: %pd (B=3D%lx)\n", dentry, inode->i_ino); } - spin_unlock(&inode->i_lock); - - return can_use; + return locked; } =20 static bool cachefiles_mark_inode_in_use(struct cachefiles_object *object, @@ -57,10 +54,9 @@ static void __cachefiles_unmark_inode_in_use(struct cach= efiles_object *object, struct inode *inode =3D d_backing_inode(dentry); =20 spin_lock(&inode->i_lock); - inode->i_flags &=3D ~S_KERNEL_FILE; - inode->i_state &=3D ~I_NO_REMOVE; + inode->i_state |=3D I_NO_REMOVE; spin_unlock(&inode->i_lock); - trace_cachefiles_mark_inactive(object, inode); + inode_excl_inuse_unlock(dentry, object ? object->debug_id : 0); } =20 /* @@ -754,7 +750,7 @@ static struct dentry *cachefiles_lookup_for_cull(struct= cachefiles_cache *cache, goto lookup_error; if (d_is_negative(victim)) goto lookup_put; - if (d_inode(victim)->i_flags & S_KERNEL_FILE) + if (inode_is_excl_inuse(victim)) goto lookup_busy; return victim; =20 @@ -790,6 +786,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, str= uct dentry *dir, { struct dentry *victim; struct inode *inode; + bool locked; int ret; =20 _enter(",%pd/,%s", dir, filename); @@ -798,19 +795,16 @@ int cachefiles_cull(struct cachefiles_cache *cache, s= truct dentry *dir, if (IS_ERR(victim)) return PTR_ERR(victim); =20 - /* check to see if someone is using this object */ + /* Check to see if someone is using this object and, if not, stop the + * cache from picking it back up. + */ inode =3D d_inode(victim); inode_lock(inode); - if (inode->i_flags & S_KERNEL_FILE) { - ret =3D -EBUSY; - } else { - /* Stop the cache from picking it back up */ - inode->i_flags |=3D S_KERNEL_FILE; - ret =3D 0; - } + locked =3D inode_excl_inuse_trylock(victim, 0, + inode_excl_inuse_by_cachefiles); inode_unlock(inode); - if (ret < 0) - goto error_unlock; + if (!locked) + goto busy; =20 ret =3D cachefiles_bury_object(cache, NULL, dir, victim, FSCACHE_OBJECT_WAS_CULLED); @@ -822,8 +816,8 @@ int cachefiles_cull(struct cachefiles_cache *cache, str= uct dentry *dir, _leave(" =3D 0"); return 0; =20 -error_unlock: - inode_unlock(d_inode(dir)); +busy: + ret =3D -EBUSY; error: dput(victim); if (ret =3D=3D -ENOENT) diff --git a/include/linux/fs.h b/include/linux/fs.h index a273d5cde731..009ca9f783bd 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2161,7 +2161,6 @@ struct super_operations { #define S_ENCRYPTED (1 << 14) /* Encrypted file (using fs/crypto/) */ #define S_CASEFOLD (1 << 15) /* Casefolded file */ #define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */ -#define S_KERNEL_FILE (1 << 17) /* File is in use by the kernel (eg. fs/ca= chefiles) */ =20 /* * Note that nosuid etc flags are inode-specific: setting some file-system @@ -2394,6 +2393,7 @@ static inline bool inode_is_dirtytime_only(struct ino= de *inode) } =20 enum inode_excl_inuse_by { + inode_excl_inuse_by_cachefiles, inode_excl_inuse_by_overlayfs, }; =20 From nobody Mon Jun 29 23:19:59 2026 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 89346C43217 for ; Mon, 31 Jan 2022 15:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379409AbiAaPOs (ORCPT ); Mon, 31 Jan 2022 10:14:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29813 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377073AbiAaPOZ (ORCPT ); Mon, 31 Jan 2022 10:14:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643642065; 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=7ChuemeG/jS317xBBF70oFf4WwBZNenz/LAHILjMr9M=; b=ZC480syZYNIXX1Q5pzvL/xeyK30D22uzQfzZ533vM9/ViXS7CQv/CDqPVec5NuwiKWtJuc wpnxfieLqkvVysftwUne3+oC7tOOstbwII90yoEv6Me1AeIaO0w1pED6mSdb7IkHDCEjid nQFhL2mlKJhpT2i2wZHwZQrMONCGf9o= 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-210-12WqAvEZP8mzhmuwdmMDXw-1; Mon, 31 Jan 2022 10:14:23 -0500 X-MC-Unique: 12WqAvEZP8mzhmuwdmMDXw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 164CE1091DC3; Mon, 31 Jan 2022 15:14:22 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B69C84D0D; Mon, 31 Jan 2022 15:14:09 +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 Subject: [PATCH 5/5] cachefiles: Remove the now-unused mark-inode-in-use tracepoints From: David Howells To: Amir Goldstein Cc: linux-cachefs@redhat.com, dhowells@redhat.com, Christoph Hellwig , Miklos Szeredi , Jeff Layton , Alexander Viro , torvalds@linux-foundation.org, linux-unionfs@vger.kernel.org, linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 31 Jan 2022 15:14:08 +0000 Message-ID: <164364204859.1476539.8259104934674309990.stgit@warthog.procyon.org.uk> In-Reply-To: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> References: <164364196407.1476539.8450117784231043601.stgit@warthog.procyon.org.uk> User-Agent: StGit/1.4 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cachefiles tracepoints that relate to marking an inode in-use with the S_KERNEL_FILE inode flag are now unused, superseded by general tracepoints. Signed-off-by: David Howells cc: linux-cachefs@redhat.com --- include/trace/events/cachefiles.h | 63 ---------------------------------= ---- 1 file changed, 63 deletions(-) diff --git a/include/trace/events/cachefiles.h b/include/trace/events/cache= files.h index c6f5aa74db89..1c56f9889f69 100644 --- a/include/trace/events/cachefiles.h +++ b/include/trace/events/cachefiles.h @@ -552,69 +552,6 @@ TRACE_EVENT(cachefiles_trunc, __entry->to) ); =20 -TRACE_EVENT(cachefiles_mark_active, - TP_PROTO(struct cachefiles_object *obj, - struct inode *inode), - - TP_ARGS(obj, inode), - - /* Note that obj may be NULL */ - TP_STRUCT__entry( - __field(unsigned int, obj ) - __field(ino_t, inode ) - ), - - TP_fast_assign( - __entry->obj =3D obj ? obj->debug_id : 0; - __entry->inode =3D inode->i_ino; - ), - - TP_printk("o=3D%08x B=3D%lx", - __entry->obj, __entry->inode) - ); - -TRACE_EVENT(cachefiles_mark_failed, - TP_PROTO(struct cachefiles_object *obj, - struct inode *inode), - - TP_ARGS(obj, inode), - - /* Note that obj may be NULL */ - TP_STRUCT__entry( - __field(unsigned int, obj ) - __field(ino_t, inode ) - ), - - TP_fast_assign( - __entry->obj =3D obj ? obj->debug_id : 0; - __entry->inode =3D inode->i_ino; - ), - - TP_printk("o=3D%08x B=3D%lx", - __entry->obj, __entry->inode) - ); - -TRACE_EVENT(cachefiles_mark_inactive, - TP_PROTO(struct cachefiles_object *obj, - struct inode *inode), - - TP_ARGS(obj, inode), - - /* Note that obj may be NULL */ - TP_STRUCT__entry( - __field(unsigned int, obj ) - __field(ino_t, inode ) - ), - - TP_fast_assign( - __entry->obj =3D obj ? obj->debug_id : 0; - __entry->inode =3D inode->i_ino; - ), - - TP_printk("o=3D%08x B=3D%lx", - __entry->obj, __entry->inode) - ); - TRACE_EVENT(cachefiles_vfs_error, TP_PROTO(struct cachefiles_object *obj, struct inode *backer, int error, enum cachefiles_error_trace where),