All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/squashfs: Remove caching of errors in squashfs.
@ 2020-10-19 13:37 Mikael Szreder
  2021-01-07 10:29 ` Mikael Szreder
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Szreder @ 2020-10-19 13:37 UTC (permalink / raw)
  To: Phillip Lougher, linux-kernel

If squashfs encounters a read error when reading a block this error will
be cached. When the underlying problem that caused this error is fixed,
squashfs will still report the previous error, even though, a re-read
would now be successful.

This patch fixes this by setting the block field of the cache entry to
SQUASHFS_INVALID_BLK if an error was encountered. This prevents the cache
entry lookup from simply returning the cache entry with the previous error.

With this patch a mounted squashfs file system can recover from read
errors. Whereas previously this would have required a full remount.

Signed-off-by: Mikael Szreder <miksz574@student.liu.se>
---
 fs/squashfs/cache.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
index 5062326d0efb..020fded42a6b 100644
--- a/fs/squashfs/cache.c
+++ b/fs/squashfs/cache.c
@@ -112,8 +112,10 @@ struct squashfs_cache_entry *squashfs_cache_get(struct super_block *sb,
 
 			spin_lock(&cache->lock);
 
-			if (entry->length < 0)
+			if (entry->length < 0) {
+				entry->block = SQUASHFS_INVALID_BLK;
 				entry->error = entry->length;
+			}
 
 			entry->pending = 0;
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] fs/squashfs: Remove caching of errors in squashfs.
  2020-10-19 13:37 [PATCH] fs/squashfs: Remove caching of errors in squashfs Mikael Szreder
@ 2021-01-07 10:29 ` Mikael Szreder
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Szreder @ 2021-01-07 10:29 UTC (permalink / raw)
  To: Phillip Lougher, linux-kernel

This is a resubmit of this patch, originally sent on the 19 Oct 2020.

If squashfs encounters a read error when reading a block this error will
be cached. When the underlying problem that caused this error is fixed,
squashfs will still report the previous error, even though, a re-read
would now be successful.

This patch fixes this by setting the block field of the cache entry to
SQUASHFS_INVALID_BLK if an error was encountered. This prevents the cache
entry lookup from simply returning the cache entry with the previous error.

With this patch a mounted squashfs file system can recover from read
errors. Whereas previously this would have required a full remount.

Signed-off-by: Mikael Szreder <miksz574@student.liu.se>
---
 fs/squashfs/cache.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
index 5062326d0efb..020fded42a6b 100644
--- a/fs/squashfs/cache.c
+++ b/fs/squashfs/cache.c
@@ -112,8 +112,10 @@ struct squashfs_cache_entry *squashfs_cache_get(struct super_block *sb,
 
                         spin_lock(&cache->lock);
 
-                       if (entry->length < 0)
+                       if (entry->length < 0) {
+                               entry->block = SQUASHFS_INVALID_BLK;
                                 entry->error = entry->length;
+                       }
 
                         entry->pending = 0;
 
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-07 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 13:37 [PATCH] fs/squashfs: Remove caching of errors in squashfs Mikael Szreder
2021-01-07 10:29 ` Mikael Szreder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.