diff options
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index beee7f5787e6..60aa5ad09a2f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -344,13 +344,19 @@ static int vhost_attach_cgroups(struct vhost_dev *dev) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | /* Caller should have device mutex */ | 346 | /* Caller should have device mutex */ |
347 | bool vhost_dev_has_owner(struct vhost_dev *dev) | ||
348 | { | ||
349 | return dev->mm; | ||
350 | } | ||
351 | |||
352 | /* Caller should have device mutex */ | ||
347 | long vhost_dev_set_owner(struct vhost_dev *dev) | 353 | long vhost_dev_set_owner(struct vhost_dev *dev) |
348 | { | 354 | { |
349 | struct task_struct *worker; | 355 | struct task_struct *worker; |
350 | int err; | 356 | int err; |
351 | 357 | ||
352 | /* Is there an owner already? */ | 358 | /* Is there an owner already? */ |
353 | if (dev->mm) { | 359 | if (vhost_dev_has_owner(dev)) { |
354 | err = -EBUSY; | 360 | err = -EBUSY; |
355 | goto err_mm; | 361 | goto err_mm; |
356 | } | 362 | } |