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: Dr. David Alan Gilbert
Subject: Re: [PATCH 085/104] virtiofsd: Support remote posix locks
Date: Fri, 17 Jan 2020 09:27:41 +0000
User-agent: Mutt/1.13.0 (2019-11-30)

* Vivek Goyal (address@hidden) wrote:
> 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.

Fixed in my tree.

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

Thanks!

Dave

> > Thanks,
> > Masa
> > 
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK




reply via email to

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