shared tag queue barrier comment
[sfrench/cifs-2.6.git] / fs / inotify_user.c
index 55f6da55b7c0ec36f8e76307c512999570103e4e..9bf2f6c09df64932bba2f88e838a240f7e4e2eea 100644 (file)
@@ -455,8 +455,16 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
                        break;
 
                kevent = inotify_dev_get_event(dev);
-               if (event_size + kevent->event.len > count)
+               if (event_size + kevent->event.len > count) {
+                       if (ret == 0 && count > 0) {
+                               /*
+                                * could not get a single event because we
+                                * didn't have enough buffer space.
+                                */
+                               ret = -EINVAL;
+                       }
                        break;
+               }
 
                if (copy_to_user(buf, &kevent->event, event_size)) {
                        ret = -EFAULT;
@@ -708,10 +716,10 @@ static int __init inotify_user_setup(void)
 
        watch_cachep = kmem_cache_create("inotify_watch_cache",
                                         sizeof(struct inotify_user_watch),
-                                        0, SLAB_PANIC, NULL, NULL);
+                                        0, SLAB_PANIC, NULL);
        event_cachep = kmem_cache_create("inotify_event_cache",
                                         sizeof(struct inotify_kernel_event),
-                                        0, SLAB_PANIC, NULL, NULL);
+                                        0, SLAB_PANIC, NULL);
 
        return 0;
 }