[libvirt] [PATCH 2/6] storage: fs: Fill in permissions on pool refresh

Peter Krempa pkrempa at redhat.com
Tue Apr 28 12:06:16 UTC 2015


On Mon, Apr 27, 2015 at 16:48:40 -0400, Cole Robinson wrote:
> This means pool XML actually reports accurate user/group/mode/label.
> 
> This uses UpdateVolTargetInfoFD in a bit of a hackish way, but it works
> ---
>  src/storage/storage_backend_fs.c | 58 ++++++++++++++++++++++++++++++----------
>  1 file changed, 44 insertions(+), 14 deletions(-)
> 
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index 51d6bb3..804b7c3 100644
> --- a/src/storage/storage_backend_fs.c

...

> +    pool->def->target.perms.mode = target->perms->mode;
> +    pool->def->target.perms.uid = target->perms->uid;
> +    pool->def->target.perms.gid = target->perms->gid;
> +    VIR_FREE(pool->def->target.perms.label);
> +    if (VIR_STRDUP(pool->def->target.perms.label, target->perms->label) < 0)
> +        goto error;
>  
> +    ret = 0;
>   error:

Since both success and error paths use this label now, it should be
called 'cleanup';

>      if (dir)
>          closedir(dir);
> +    VIR_FORCE_CLOSE(fd);
>      virStorageVolDefFree(vol);
> -    virStoragePoolObjClearVols(pool);
> -    return -1;
> +    virStorageSourceFree(target);
> +    if (ret < 0)
> +        virStoragePoolObjClearVols(pool);
> +    return ret;
>  }

ACK with the label renamed.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150428/e789d654/attachment-0001.sig>


More information about the libvir-list mailing list