]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xenbus: fix deadlock on writes to /proc/xen/xenbus
authorDavid Vrabel <david.vrabel@citrix.com>
Fri, 9 Dec 2016 14:41:13 +0000 (14:41 +0000)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 23 Jan 2017 07:14:06 +0000 (23:14 -0800)
/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>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Orabug: 25425387
(cherry picked from commit 581d21a2d02a798ee34e56dbfa13f891b3a90c30)
Jira: OCC-36718
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Chuck Anderson <chuck.anderson@oracle.com>
drivers/xen/xenbus/xenbus_dev_frontend.c

index 32f8186ca92f02c4e41ca04afaaee0600a289670..ee10d8e6261f0257760ecaa6718c56e076fba7db 100644 (file)
@@ -540,6 +540,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;