* [PATCH] Btrfs-progs: fix a bug of converting sparse ext2/3/4
@ 2014-11-25 9:35 Liu Bo
0 siblings, 0 replies; only message in thread
From: Liu Bo @ 2014-11-25 9:35 UTC (permalink / raw)
To: linux-btrfs
When converting a sparse ext* filesystem, btrfs-convert adds checksum extents
for empty extents, whose disk_bytenr = 0, and this can end up with some weird
problems, one of them is the failure of reading free space cache inode on
mounting converted btrfs.
The fix is simple, just to skip making checksum on empty extents.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
btrfs-convert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/btrfs-convert.c b/btrfs-convert.c
index a544fc6..02c5e94 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -393,7 +393,7 @@ static int record_file_blocks(struct btrfs_trans_handle *trans,
ret = btrfs_record_file_extent(trans, root, objectid, inode, file_pos,
disk_bytenr, num_bytes);
- if (ret || !checksum)
+ if (ret || !checksum || disk_bytenr == 0)
return ret;
return csum_disk_extent(trans, root, disk_bytenr, num_bytes);
--
1.8.1.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-25 9:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25 9:35 [PATCH] Btrfs-progs: fix a bug of converting sparse ext2/3/4 Liu Bo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).