Re: [PATCH -v3 5/8] fsnotify: unified filesystem notificationbackend

From: Eric Paris
Date: Fri Nov 28 2008 - 18:23:43 EST


On Thu, 2008-11-27 at 17:20 +0100, Peter Zijlstra wrote:
> On Tue, 2008-11-25 at 12:21 -0500, Eric Paris wrote:
> > +int fsnotify_check_notif_queue(struct fsnotify_group *group)
> > +{
> > + mutex_lock(&group->notification_mutex);
> > + if (!list_empty(&group->notification_list))
> > + return 1;
> > + mutex_unlock(&group->notification_mutex);
> > + return 0;
> > +}
>
> > +void fsnotify_clear_notif(struct fsnotify_group *group)
> > +{
> > + struct fsnotify_event *event;
> > +
> > + while (fsnotify_check_notif_queue(group)) {
> > + event = get_event_from_notif(group);
> > + fsnotify_put_event(event);
> > + /* fsnotify_check_notif_queue() took this lock */
> > + mutex_unlock(&group->notification_mutex);
> > + }
> > +}
>
> That is quite horrible, please just open code that to keep the locking
> symmetric.

While horrible, I use fsnotify_check_notif_queue in my fsnotify (not in
this series as this only includes dnotify) has

wait_event_interruptible(group->notification_waitq, fanotify_check_notif_queue(group));

So I wouldn't know how to open code that... I can open code this
instance, but it's going to mean redoing all of that other code to
handle having thing not be present when we return. Since I didn't
submit that as well I guess I'm not allowed to use it as a reason...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/