inotify: do not send a block of zeros when no pathname is available

When an event has no pathname, there's no need to pad it with a null byte and
therefore generate an inotify_event sized block of zeros. This fixes a
regression introduced by commit 0db501bd0610ee0c0aca84d927f90bcccd09e2bd where
my system wouldn't finish booting because some process was being confused by
this.

Signed-off-by: Brian Rogers <brian@xyzw.org>
Signed-off-by: Eric Paris <eparis@redhat.com>

authored by Brian Rogers and committed by Eric Paris b962e731 326ba501

+5 -3
+5 -3
fs/notify/inotify/inotify_user.c
··· 180 struct fsnotify_event_private_data *fsn_priv; 181 struct inotify_event_private_data *priv; 182 size_t event_size = sizeof(struct inotify_event); 183 - size_t name_len; 184 185 /* we get the inotify watch descriptor from the event private data */ 186 spin_lock(&event->lock); ··· 196 inotify_free_event_priv(fsn_priv); 197 } 198 199 - /* round up event->name_len so it is a multiple of event_size 200 * plus an extra byte for the terminating '\0'. 201 */ 202 - name_len = roundup(event->name_len + 1, event_size); 203 inotify_event.len = name_len; 204 205 inotify_event.mask = inotify_mask_to_arg(event->mask);
··· 180 struct fsnotify_event_private_data *fsn_priv; 181 struct inotify_event_private_data *priv; 182 size_t event_size = sizeof(struct inotify_event); 183 + size_t name_len = 0; 184 185 /* we get the inotify watch descriptor from the event private data */ 186 spin_lock(&event->lock); ··· 196 inotify_free_event_priv(fsn_priv); 197 } 198 199 + /* 200 + * round up event->name_len so it is a multiple of event_size 201 * plus an extra byte for the terminating '\0'. 202 */ 203 + if (event->name_len) 204 + name_len = roundup(event->name_len + 1, event_size); 205 inotify_event.len = name_len; 206 207 inotify_event.mask = inotify_mask_to_arg(event->mask);