lkml.org 
[lkml]   [2017]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 7/7] fanotify: clean up CONFIG_FANOTIFY_ACCESS_PERMISSIONS ifdefs
On Wed, Oct 25, 2017 at 1:44 PM, Amir Goldstein <amir73il@gmail.com> wrote:
>> +static inline bool fanotify_is_perm_event(u32 mask)
>> +{
>> + return IS_ENABLED(CONFIG_FANOTIFY_ACCESS_PERMISSIONS) &&
>> + mask & FAN_ALL_PERM_EVENTS;
>
> I know this is good w.r.t operation precedence, but it gets me eerie to see
> bit masking without (). maybe its just me.

Yeah, not easy to get used to, but here I don't think it hurts readability.

>> + } else
>> + FANOTIFY_PE(fsn_event)->response = FAN_ALLOW;
>
> Not your change, but if you post another version please add {} after else

Okay.

>
>> + }
>> + spin_unlock(&group->notification_lock);
>>
>> - /*
>> - * Destroy all non-permission events. For permission events just
>> - * dequeue them and set the response. They will be freed once the
>> - * response is consumed and fanotify_get_response() returns.
>> - */
>> - while (!fsnotify_notify_queue_is_empty(group)) {
>> - fsn_event = fsnotify_remove_first_event(group);
>> - if (!(fsn_event->mask & FAN_ALL_PERM_EVENTS)) {
>> - spin_unlock(&group->notification_lock);
>> - fsnotify_destroy_event(group, fsn_event);
>> - spin_lock(&group->notification_lock);
>> - } else
>> - FANOTIFY_PE(fsn_event)->response = FAN_ALLOW;
>> + /* Response for all permission events it set, wakeup waiters */
>> + wake_up(&group->fanotify_data.access_waitq);
>> }
>> - spin_unlock(&group->notification_lock);
>> -
>> - /* Response for all permission events it set, wakeup waiters */
>> - wake_up(&group->fanotify_data.access_waitq);
>
> So I might as well learn something from this review -
> why did you move wake_up inside spinlock? Does it matter at all?

It would be strange if I did that. But I didn't, it's just that diff
sometimes doesn't make it easy to read the (non) change.

Thanks,
Miklos

\
 
 \ /
  Last update: 2017-10-25 16:19    [W:0.053 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site