* [PATCH RFC 1/3] fs: tftp: remove duplicate header
2019-08-22 6:50 [PATCH RFC 0/3] fs: tftp: don't use cached dentries Ahmad Fatoum
@ 2019-08-22 6:51 ` Ahmad Fatoum
2019-08-22 6:51 ` [PATCH RFC 2/3] fs: provide no_revalidate_d_ops for network file systems Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2019-08-22 6:51 UTC (permalink / raw)
To: barebox
<fs.h> is included again a few lines prior. Delete it here.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
fs/tftp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/tftp.c b/fs/tftp.c
index 43293272d7e9..54dcba272fb8 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -29,7 +29,6 @@
#include <libgen.h>
#include <fcntl.h>
#include <getopt.h>
-#include <fs.h>
#include <init.h>
#include <linux/stat.h>
#include <linux/err.h>
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH RFC 2/3] fs: provide no_revalidate_d_ops for network file systems
2019-08-22 6:50 [PATCH RFC 0/3] fs: tftp: don't use cached dentries Ahmad Fatoum
2019-08-22 6:51 ` [PATCH RFC 1/3] fs: tftp: remove duplicate header Ahmad Fatoum
@ 2019-08-22 6:51 ` Ahmad Fatoum
2019-08-22 6:51 ` [PATCH RFC 3/3] fs: tftp: don't maintain tftp dentries in dcache Ahmad Fatoum
2019-08-23 7:38 ` [PATCH RFC 0/3] fs: tftp: don't use cached dentries Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2019-08-22 6:51 UTC (permalink / raw)
To: barebox
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 <ahmad@a3f.at>
---
fs/fs.c | 9 +++++++++
include/linux/dcache.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/fs/fs.c b/fs/fs.c
index c6cb49996ec5..dda19db91341 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 1581ddc701d3..a9619422013e 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 */
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH RFC 3/3] fs: tftp: don't maintain tftp dentries in dcache
2019-08-22 6:50 [PATCH RFC 0/3] fs: tftp: don't use cached dentries Ahmad Fatoum
2019-08-22 6:51 ` [PATCH RFC 1/3] fs: tftp: remove duplicate header Ahmad Fatoum
2019-08-22 6:51 ` [PATCH RFC 2/3] fs: provide no_revalidate_d_ops for network file systems Ahmad Fatoum
@ 2019-08-22 6:51 ` Ahmad Fatoum
2019-08-23 7:38 ` [PATCH RFC 0/3] fs: tftp: don't use cached dentries Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2019-08-22 6:51 UTC (permalink / raw)
To: barebox
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 <ahmad@a3f.at>
---
fs/tftp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/tftp.c b/fs/tftp.c
index 54dcba272fb8..1f36c56511ac 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);
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RFC 0/3] fs: tftp: don't use cached dentries
2019-08-22 6:50 [PATCH RFC 0/3] fs: tftp: don't use cached dentries Ahmad Fatoum
` (2 preceding siblings ...)
2019-08-22 6:51 ` [PATCH RFC 3/3] fs: tftp: don't maintain tftp dentries in dcache Ahmad Fatoum
@ 2019-08-23 7:38 ` Sascha Hauer
3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2019-08-23 7:38 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On Thu, Aug 22, 2019 at 08:50:59AM +0200, Ahmad Fatoum wrote:
> I often mistype the name of files I place into the TFTP server's root
> directory. When barebox does a TFTP lookup for the correct file name and
> doesn't find it, it refuses to look it up again. I'd argue the better
> user experience for TFTP in particular would be to not use the dcache
> altogether. Not sure if other networked file systems should follow suit,
> as staleness means faster acceses, but lets do this for TFTP now.
>
> The file is still placed and invalidated from the cache though, but
> compared to the network access before, it's negligible overhead.
>
> Ahmad Fatoum (3):
> fs: tftp: remove duplicate header
> fs: provide no_revalidate_d_ops for network file systems
> fs: tftp: don't maintain tftp dentries in dcache
Applied, thanks. I stumbled upon this behaviour myself aswell.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread