* Vivek Goyal (vgo...@redhat.com) 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 <m.miz...@jp.fujitsu.com> Thanks! Dave > > Thanks, > > Masa > > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK