Merge branch 'master' into for-linus
Jens Axboe [Tue, 1 Jun 2010 10:42:12 +0000 (12:42 +0200)]
Conflicts:
fs/pipe.c

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>

1  2 
fs/fs-writeback.c
fs/pipe.c
fs/sync.c

Simple merge
diff --cc fs/pipe.c
+++ b/fs/pipe.c
@@@ -1162,30 -1174,23 +1168,34 @@@ long pipe_fcntl(struct file *file, unsi
        mutex_lock(&pipe->inode->i_mutex);
  
        switch (cmd) {
 -      case F_SETPIPE_SZ:
 -              if (!capable(CAP_SYS_ADMIN) && arg > pipe_max_pages) {
 -                      ret = -EINVAL;
 +      case F_SETPIPE_SZ: {
 +              unsigned long nr_pages;
 +
 +              /*
 +               * Currently the array must be a power-of-2 size, so adjust
 +               * upwards if needed.
 +               */
 +              nr_pages = (arg + PAGE_SIZE - 1) >> PAGE_SHIFT;
 +              nr_pages = roundup_pow_of_two(nr_pages);
 +
-               if (!capable(CAP_SYS_ADMIN) && nr_pages > pipe_max_pages)
-                       return -EPERM;
++              if (!capable(CAP_SYS_ADMIN) && nr_pages > pipe_max_pages) {
++                      ret = -EPERM;
+                       goto out;
+               }
 +
                /*
                 * The pipe needs to be at least 2 pages large to
                 * guarantee POSIX behaviour.
                 */
-               if (nr_pages < 2)
-                       return -EINVAL;
-               ret = pipe_set_size(pipe, nr_pages);
+               if (arg < 2) {
+                       ret = -EINVAL;
+                       goto out;
+               }
+               ret = pipe_set_size(pipe, arg);
                break;
 +              }
        case F_GETPIPE_SZ:
 -              ret = pipe->buffers;
 +              ret = pipe->buffers * PAGE_SIZE;
                break;
        default:
                ret = -EINVAL;
diff --cc fs/sync.c
Simple merge