Re: [PATCH 5/8] Keep read and write fds with each nlm_file

Chuck Lever III
2021-08-23T22:01:01Z

> On Aug 23, 2021, at 5:58 PM, Bruce Fields <bfields@fieldses.org> wrote:
>
> On Mon, Aug 23, 2021 at 09:54:20PM +0000, Chuck Lever III wrote:
>>> On Aug 23, 2021, at 4:44 PM, Bruce Fields <bfields@fieldses.org> wrote:
>>> +static int nlm_unlock_files(struct nlm_file *file)
>>> +{
>>> + struct file_lock lock;
>>> + struct file *f;
>>> +
>>> + lock.fl_type = F_UNLCK;
>>> + lock.fl_start = 0;
>>> + lock.fl_end = OFFSET_MAX;
>>> + for (f = file->f_file[0]; f <= file->f_file[1]; f++) {
>>
>> O_RDONLY and O_WRONLY ?
>
> I thought they looked weird as loop boundaries.
>
>>> @@ -301,7 +305,8 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
>>>
>>> static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
>>> {
>>> - return locks_inode(file->f_file);
>>> + return locks_inode(file->f_file[0] ?
>>> + file->f_file[0] : file->f_file[1]);
>>
>> O_RDONLY and O_WRONLY ?
>
> A little less weird.
>
> OK, I admit, "looks weird" isn't much of an argument.
>
> I say we leave it to whoever cares enough to make the change.

I can update nlmsvc_file_inode() when I apply this version
of the patch, and leave the loops alone.

--
Chuck Lever