From: David Vrabel <david.vrabel@citrix.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: David Vrabel <david.vrabel@citrix.com>,
<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<xen-devel@lists.xenproject.org>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>
Subject: [PATCHv4 2/3] xenfs: replace xenbus and privcmd with symlinks
Date: Fri, 28 Oct 2016 16:52:38 +0100 [thread overview]
Message-ID: <1477669959-9486-3-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1477669959-9486-1-git-send-email-david.vrabel@citrix.com>
/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@citrix.com>
---
v4:
- Make xen_xenbus_fops and xen_privcmd_fops static.
---
drivers/xen/privcmd.c | 5 +----
drivers/xen/privcmd.h | 3 ---
drivers/xen/xenbus/xenbus_comms.h | 2 --
drivers/xen/xenbus/xenbus_dev_frontend.c | 3 +--
drivers/xen/xenfs/super.c | 10 ++++------
5 files changed, 6 insertions(+), 17 deletions(-)
delete mode 100644 drivers/xen/privcmd.h
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 702040f..12ece8d 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -37,8 +37,6 @@
#include <xen/xen-ops.h>
#include <xen/balloon.h>
-#include "privcmd.h"
-
MODULE_LICENSE("GPL");
#define PRIV_VMA_LOCKED ((void *)1)
@@ -644,12 +642,11 @@ static int privcmd_vma_range_is_mapped(
is_mapped_fn, NULL) != 0;
}
-const struct file_operations xen_privcmd_fops = {
+const static struct file_operations xen_privcmd_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = privcmd_ioctl,
.mmap = privcmd_mmap,
};
-EXPORT_SYMBOL_GPL(xen_privcmd_fops);
static struct miscdevice privcmd_dev = {
.minor = MISC_DYNAMIC_MINOR,
diff --git a/drivers/xen/privcmd.h b/drivers/xen/privcmd.h
deleted file mode 100644
index 14facae..0000000
--- a/drivers/xen/privcmd.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <linux/fs.h>
-
-extern const struct file_operations xen_privcmd_fops;
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index e74f9c1..39efb85 100644
--- a/drivers/xen/xenbus/xenbus_comms.h
+++ b/drivers/xen/xenbus/xenbus_comms.h
@@ -47,6 +47,4 @@ extern struct xenstore_domain_interface *xen_store_interface;
extern int xen_store_evtchn;
extern enum xenstore_init xen_store_domain_type;
-extern const struct file_operations xen_xenbus_fops;
-
#endif /* _XENBUS_COMMS_H */
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index c1010f01..a45e7f2 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -598,7 +598,7 @@ static unsigned int xenbus_file_poll(struct file *file, poll_table *wait)
return 0;
}
-const struct file_operations xen_xenbus_fops = {
+const static struct file_operations xen_xenbus_fops = {
.read = xenbus_file_read,
.write = xenbus_file_write,
.open = xenbus_file_open,
@@ -606,7 +606,6 @@ const struct file_operations xen_xenbus_fops = {
.poll = xenbus_file_poll,
.llseek = no_llseek,
};
-EXPORT_SYMBOL_GPL(xen_xenbus_fops);
static struct miscdevice xenbus_dev = {
.minor = MISC_DYNAMIC_MINOR,
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
--
2.1.4
next prev parent reply other threads:[~2016-10-28 15:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-28 15:52 [PATCH v4 0/3] libfs,xenfs: replace /proc/xen/xenbus with a symlink David Vrabel
2016-10-28 15:52 ` [PATCHv4 1/3] libfs: allow simple_fill_super() to add symlinks David Vrabel
2016-10-28 15:52 ` David Vrabel [this message]
2016-10-28 15:52 ` [PATCHv4 3/3] xenfs: Use proc_create_mount_point() to create /proc/xen David Vrabel
2016-10-28 16:22 ` [PATCH v4 0/3] libfs,xenfs: replace /proc/xen/xenbus with a symlink Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477669959-9486-3-git-send-email-david.vrabel@citrix.com \
--to=david.vrabel@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).