summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2023-11-07 20:35:37 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2023-11-25 10:31:04 +0300
commitb31559f8e471f402cd71117f35b9cde52d192138 (patch)
tree6419ab71ed94d5b5ba54c6d7d632d7be5ce8eb3b /fs
parentb7a14708aafeb12730ab23de8ecedd14f401a30c (diff)
downloadlinux-b31559f8e471f402cd71117f35b9cde52d192138.tar.xz
coda_flag_children(): cope with dentries turning negative
->d_lock on parent does not stabilize ->d_inode of child. We don't do much with that inode in there, but we need at least to avoid struct inode getting freed under us... [rcu_read_lock() is not needed here, since parent's ->d_lock provides an rcu-critical area] Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/coda/cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/coda/cache.c b/fs/coda/cache.c
index 3b8c4513118f..d6254cf9f397 100644
--- a/fs/coda/cache.c
+++ b/fs/coda/cache.c
@@ -94,12 +94,12 @@ static void coda_flag_children(struct dentry *parent, int flag)
spin_lock(&parent->d_lock);
list_for_each_entry(de, &parent->d_subdirs, d_child) {
+ struct inode *inode = d_inode_rcu(de);
/* don't know what to do with negative dentries */
- if (d_inode(de) )
- coda_flag_inode(d_inode(de), flag);
+ if (inode)
+ coda_flag_inode(inode, flag);
}
spin_unlock(&parent->d_lock);
- return;
}
void coda_flag_inode_children(struct inode *inode, int flag)