Re: [PATCHv3 2/2] xenfs: replace xenbus and privcmd with symlinks

From: Juergen Gross
Date: Wed Jun 29 2016 - 00:51:03 EST


On 28/06/16 20:06, David Vrabel wrote:
> /proc/xen/xenbus does not work correctly. A read blocked waiting for
> a xenstore message holds the mutex needed for atomic file position
> updates. This blocks any writes on the same file handle, which can
> deadlock if the write is needed to unblock the read.
>
> /proc/xen/xenbus is supposed to be identical to the character device
> /dev/xen/xenbus so replace the file with a symlink.
>
> Similarly, replace /proc/xen/privcmd with a symlink since it should be
> the same as /dev/xen/privcmd.
>
> Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
> ---
> v2:
> - remove unneeded includes
> ---

I think you should make xen_xenbus_fops and xen_privcmd_fops static
now that they are no longer referenced by super.c


Juergen

> drivers/xen/xenfs/super.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
> index 8559a71..0f2e2cd 100644
> --- a/drivers/xen/xenfs/super.c
> +++ b/drivers/xen/xenfs/super.c
> @@ -18,8 +18,6 @@
> #include <xen/xen.h>
>
> #include "xenfs.h"
> -#include "../privcmd.h"
> -#include "../xenbus/xenbus_comms.h"
>
> #include <asm/xen/hypervisor.h>
>
> @@ -45,16 +43,16 @@ static const struct file_operations capabilities_file_ops = {
> static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
> {
> static struct tree_descr xenfs_files[] = {
> - [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
> + [2] = { "xenbus", NULL, S_IFLNK | S_IRWXUGO, "/dev/xen/xenbus" },
> { "capabilities", &capabilities_file_ops, S_IRUGO },
> - { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
> + { "privcmd", NULL, S_IFLNK | S_IRWXUGO, "/dev/xen/privcmd" },
> {""},
> };
>
> static struct tree_descr xenfs_init_files[] = {
> - [2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
> + [2] = { "xenbus", NULL, S_IFLNK | S_IRWXUGO, "/dev/xen/xenbus" },
> { "capabilities", &capabilities_file_ops, S_IRUGO },
> - { "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
> + { "privcmd", NULL, S_IFLNK | S_IRWXUGO, "/dev/xen/privcmd" },
> { "xsd_kva", &xsd_kva_file_ops, S_IRUSR|S_IWUSR},
> { "xsd_port", &xsd_port_file_ops, S_IRUSR|S_IWUSR},
> #ifdef CONFIG_XEN_SYMS
>