--- /dev/null
+diff --git a/block/bsg.c b/block/bsg.c
+index 9cfbea8..6f9644c 100644
+--- a/block/bsg.c
++++ b/block/bsg.c
+@@ -874,6 +874,12 @@ static unsigned int bsg_poll(struct file *file, poll_table *wait)
+ return mask;
+ }
+
++/* This is an ugly hack for XC to ensure exclusive access to the
++ * CD-ROM between multiple VM's. This should be handled by the caller
++ * but this will suffice for now since no-one else in dom0 will use
++ * the SG_IO interface */
++static DEFINE_MUTEX(sg_io_mutex);
++
+ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+ {
+ struct bsg_device *bd = file->private_data;
+@@ -922,16 +928,24 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+
+ if (copy_from_user(&hdr, uarg, sizeof(hdr)))
+ return -EFAULT;
+-
++
++ /* XC-Hack: */
++ /* Acquire mutex to ensure exclusive access between VMs*/
++ //if (mutex_is_locked(&sg_io_mutex))
++ // printk(KERN_NOTICE "bsg: sg_io_mutex already locked (pid=%d)\n", current->pid);
++ mutex_lock(&sg_io_mutex);
+ rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE);
+- if (IS_ERR(rq))
++ if (IS_ERR(rq)) {
++ mutex_unlock(&sg_io_mutex);
+ return PTR_ERR(rq);
++ }
+
+ bio = rq->bio;
+ if (rq->next_rq)
+ bidi_bio = rq->next_rq->bio;
+ blk_execute_rq(bd->queue, NULL, rq, 0);
+ ret = blk_complete_sgv4_hdr_rq(rq, &hdr, bio, bidi_bio);
++ mutex_unlock(&sg_io_mutex);
+
+ if (copy_to_user(uarg, &hdr, sizeof(hdr)))
+ return -EFAULT;