[PATCH] ubifs: Fix reading holes in files

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 4 03:21:44 PST 2016


When a whole block of 4KiB in an ubifs file is zero then the block is
not stored in the filesystem. read_block() returns -ENOENT in this case,
so this return value must be treated as success.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 fs/ubifs/ubifs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index a9189f7..1f31f6f 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -377,7 +377,7 @@ static int ubifs_get_block(struct ubifs_file *uf, unsigned int pos)
 
 	if (block != uf->block) {
 		ret = read_block(uf->inode, uf->buf, block, uf->dn);
-		if (ret)
+		if (ret && ret != -ENOENT)
 			return ret;
 		uf->block = block;
 	}
-- 
2.7.0.rc3




More information about the barebox mailing list