From e68c3d08dccb951476d1e31a66f31c15390e4af7 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 22 Aug 2019 08:51:00 +0200 Subject: fs: tftp: remove duplicate header is included again a few lines prior. Delete it here. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- fs/tftp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'fs') diff --git a/fs/tftp.c b/fs/tftp.c index 43293272d7..54dcba272f 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From fe201c695af55df51ee414f89e29558abab97437 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 22 Aug 2019 08:51:01 +0200 Subject: fs: provide no_revalidate_d_ops for network file systems Networked file systems may wish to forego dentry caching altogether, so every lookup goes over the network and stale data is avoided. Provide a no_revalidate_d_ops helper object that does this. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- fs/fs.c | 9 +++++++++ include/linux/dcache.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'fs') diff --git a/fs/fs.c b/fs/fs.c index c6cb49996e..dda19db913 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -1262,6 +1262,15 @@ static void d_invalidate(struct dentry *dentry) { } +static int d_no_revalidate(struct dentry *dir, unsigned int flags) +{ + return 0; +} + +const struct dentry_operations no_revalidate_d_ops = { + .d_revalidate = d_no_revalidate, +}; + static inline int d_revalidate(struct dentry *dentry, unsigned int flags) { if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 1581ddc701..a961942201 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -185,4 +185,6 @@ static inline struct inode *d_inode(const struct dentry *dentry) char *dpath(struct dentry *dentry, struct dentry *root); +extern const struct dentry_operations no_revalidate_d_ops; + #endif /* __LINUX_DCACHE_H */ -- cgit v1.2.3 From 47537564bf1d8a519ba5b5e729b2aa40a2f64942 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 22 Aug 2019 08:51:02 +0200 Subject: fs: tftp: don't maintain tftp dentries in dcache Currently a negative dentry is cached whenever a non-existing file was looked up over TFTP. Short of a barebox reset, there is no way to invalidate that dentry, so barebox retries the look up. Fix this by always reporting TFTP dentries as invalid in the d_revalidate callback. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- fs/tftp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs') diff --git a/fs/tftp.c b/fs/tftp.c index 54dcba272f..1f36c56511 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -715,6 +715,7 @@ static int tftp_probe(struct device_d *dev) } sb->s_op = &tftp_ops; + sb->s_d_op = &no_revalidate_d_ops; inode = tftp_get_inode(sb, NULL, S_IFDIR); sb->s_root = d_make_root(inode); -- cgit v1.2.3