siukoon
Contributor
Contributor

[VMwareTools] vmhgfs does not work with latest kernel d_alloc_name

Symptom: vmhgfs excounters null pointer exception and stack dump during startup.

Technical breakdown:

In VMwareTools 8.8.1,  vmhgfs-only/filesystem.c, HgfsReadSuper calls compat_d_alloc_name(NULL, "/").

However, since commit

a4464dbc0ca6a3ab8e9d1206bc05059dae2a559d

(Ref: http://permalink.gmane.org/gmane.linux.kernel.commits.head/307754), d_alloc_name does not accept NULL parent.

Per Red Hat Bugzilla advice (Ref: https://bugzilla.redhat.com/show_bug.cgi?id=755788), see if vmhgfs maintainer agree to rewrite this part to create the rootDentry.

Affected Guest system:

kernel-3.1.1-2.fc16

kernel-2.6.41.1-1.fc15

0 Kudos
1 Reply
siukoon
Contributor
Contributor

Spent some time to follow the logic and refine the codes.

This works for my kernel-3.1.6-1 (FC16) and kernel-2.6.41.4-1 (FC15).

Now, the mount point /mnt/hgfs is up.

diff vmhgfs-only-528969/file.c vmhgfs-only-siukoon/file.c

86a87,88
>                loff_t start,
>                loff_t end,
992a995,996
>        loff_t start,
>        loff_t end,
diff vmhgfs-only-528969/filesystem.c vmhgfs-only-siukoon/filesystem.c
360a361,362
>    struct dentry *tmpDentry;
>    struct inode *inode;
411c413,416
<    rootDentry = compat_d_alloc_name(NULL, "/");
---
>
>    inode = new_inode(sb);
>    tmpDentry = d_alloc_root(inode);
>    rootDentry = compat_d_alloc_name(tmpDentry, "/");
418,419c423
<    rootDentry->d_parent = rootDentry;
<    rootDentry->d_sb = sb;
---
>
0 Kudos