Message ID | 1481294473-32203-1-git-send-email-david.vrabel@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 09/12/16 15:41, 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. > > Clear FMODE_ATOMIC_POS when opening this device to always get > character device like sematics. "semantics". I can fix this when committing. > > Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Juergen Gross <jgross@suse.com> Juergen > --- > v6: > - clear flag after calling nonseekable_open(). > --- > drivers/xen/xenbus/xenbus_dev_frontend.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c > index 1e8be12..6c0ead4 100644 > --- a/drivers/xen/xenbus/xenbus_dev_frontend.c > +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c > @@ -538,6 +538,8 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) > > nonseekable_open(inode, filp); > > + filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */ > + > u = kzalloc(sizeof(*u), GFP_KERNEL); > if (u == NULL) > return -ENOMEM; >
On 09/12/16 15:41, 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. > > Clear FMODE_ATOMIC_POS when opening this device to always get > character device like sematics. > > Signed-off-by: David Vrabel <david.vrabel@citrix.com> Committed to xen/tip.git for-linus-4.10 Juergen
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 1e8be12..6c0ead4 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c @@ -538,6 +538,8 @@ static int xenbus_file_open(struct inode *inode, struct file *filp) nonseekable_open(inode, filp); + filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */ + u = kzalloc(sizeof(*u), GFP_KERNEL); if (u == NULL) return -ENOMEM;
/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. Clear FMODE_ATOMIC_POS when opening this device to always get character device like sematics. Signed-off-by: David Vrabel <david.vrabel@citrix.com> --- v6: - clear flag after calling nonseekable_open(). --- drivers/xen/xenbus/xenbus_dev_frontend.c | 2 ++ 1 file changed, 2 insertions(+)