qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 085/104] virtiofsd: Support remote posix locks


From: Vivek Goyal
Subject: Re: [PATCH 085/104] virtiofsd: Support remote posix locks
Date: Thu, 16 Jan 2020 08:26:31 -0500
User-agent: Mutt/1.12.1 (2019-06-15)

On Wed, Jan 15, 2020 at 06:38:31PM -0500, Masayoshi Mizuma wrote:

[..]
> > +/* Should be called with inode->plock_mutex held */
> > +static struct lo_inode_plock *lookup_create_plock_ctx(struct lo_data *lo,
> > +                                                      struct lo_inode 
> > *inode,
> > +                                                      uint64_t lock_owner,
> > +                                                      pid_t pid, int *err)
> > +{
> > +    struct lo_inode_plock *plock;
> > +    char procname[64];
> > +    int fd;
> > +
> > +    plock =
> > +        g_hash_table_lookup(inode->posix_locks, 
> > GUINT_TO_POINTER(lock_owner));
> > +
> > +    if (plock) {
> > +        return plock;
> > +    }
> > +
> > +    plock = malloc(sizeof(struct lo_inode_plock));
> > +    if (!plock) {
> > +        *err = ENOMEM;
> > +        return NULL;
> > +    }
> > +
> > +    /* Open another instance of file which can be used for ofd locks. */
> > +    sprintf(procname, "%i", inode->fd);
> > +
> > +    /* TODO: What if file is not writable? */
> > +    fd = openat(lo->proc_self_fd, procname, O_RDWR);
> > +    if (fd == -1) {
> 
> > +        *err = -errno;
> 
> I think the errno is positive value, so the minus isn't needed?
> 
>            *err = errno;

That's sounds right. Thanks. 

David, will you be able to do this tweak in your tree or you want me to
send a separate fix patch.

Thanks
Vivek

> 
> Otherwise looks good to me.
> 
> Reviewed-by: Masayoshi Mizuma <address@hidden>
> 
> Thanks,
> Masa
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]