Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash accessing VMFS volumes containing linked clones #15

Open
trapgate opened this issue Oct 15, 2015 · 0 comments
Open

Crash accessing VMFS volumes containing linked clones #15

trapgate opened this issue Oct 15, 2015 · 0 comments

Comments

@trapgate
Copy link

In testing I ran into a crash in vmfs-fuse (the 0.2.5 version) when mounting a volume with some linked clone VMs on it. I have a patch below, and can submit a pull request if you like, but since this project doesn't seem active I wanted to check here fist. The backtrace from the core was this:

(gdb) bt
#0 vmfs_inode_get_block (inode=0x60d8c0, pos=0, blk_id=0x7fffb322a3fc) at libvmfs/vmfs_inode.c:314
#1 0x0000000000404609 in vmfs_file_pread (f=0x60dda0, buf=0x7fffb322a600 "", len=512, pos=0)

at libvmfs/vmfs_file.c:149
#2 0x0000000000402a23 in vmfs_bitmap_open_from_file (f=0x60dda0) at libvmfs/vmfs_bitmap.c:521
#3 0x0000000000404ee2 in vmfs_open_all_meta_files (fs=0x60c380) at libvmfs/vmfs_fs.c:124
#4 vmfs_read_fdc_base (fs=0x60c380) at libvmfs/vmfs_fs.c:187
#5 0x0000000000405355 in vmfs_fs_open (paths=Unhandled dwarf expression opcode 0xf3

) at libvmfs/vmfs_fs.c:255
#6 0x0000000000401999 in main (argc=Unhandled dwarf expression opcode 0xf3

) at vmfs-fuse/vmfs-fuse.c:498

The crash was caused by this line in vmfs_inode.c:
DECL_ALIGNED_BUFFER_WOL(buf,fs->pbc->bmh.data_size);

buf.fs->pbc is null here, because the init code is reading the FBB file - it hasn't processed the PBC file yet. The following patch will fix the problem by reorganizing the code to read the PBC file first. This doesn't seem to cause any other problems.

diff --git a/libvmfs/vmfs_fs.c b/libvmfs/vmfs_fs.c
index f355526..36750fb 100644
--- a/libvmfs/vmfs_fs.c
+++ b/libvmfs/vmfs_fs.c
@@ -121,6 +121,14 @@ static int vmfs_open_all_meta_files(vmfs_fs_t *fs)
       return(-1);
    }

+   /* Read pbc first, because FBB may have blocks in it that will require access
+      to the pbc to read. */
+   fs->pbc = vmfs_open_meta_file(root_dir, VMFS_PBC_FILENAME,
+                                 VMFS_BLK_PB_MAX_ITEM, VMFS_BLK_PB_MAX_ENTRY,
+                                 "pointer block bitmap (PBC)");
+   if (!fs->pbc)
+      return(-1);
+
    if (!(fs->fbb = vmfs_bitmap_open_at(root_dir,VMFS_FBB_FILENAME))) {
       fprintf(stderr,"Unable to open file-block bitmap (FBB).\n");
       return(-1);
@@ -136,12 +144,6 @@ static int vmfs_open_all_meta_files(vmfs_fs_t *fs)
    if (!fs->fdc)
       return(-1);

-   fs->pbc = vmfs_open_meta_file(root_dir, VMFS_PBC_FILENAME,
-                                 VMFS_BLK_PB_MAX_ITEM, VMFS_BLK_PB_MAX_ENTRY,
-                                 "pointer block bitmap (PBC)");
-   if (!fs->pbc)
-      return(-1);
-
    fs->sbc = vmfs_open_meta_file(root_dir, VMFS_SBC_FILENAME,
                                  VMFS_BLK_SB_MAX_ITEM, VMFS_BLK_SB_MAX_ENTRY,
                                  "pointer block bitmap (PBC)");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant