소스 검색

pipe: adjust minimum pipe size to 1 page

We don't need to pages to guarantee the POSIX requirement
that upto a page size write must be atomic to an empty
pipe.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Jens Axboe 15 년 전
부모
커밋
6a6ca57de9
1개의 변경된 파일1개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 7
      fs/pipe.c

+ 1 - 7
fs/pipe.c

@@ -1181,13 +1181,7 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
 		if (!capable(CAP_SYS_ADMIN) && nr_pages > pipe_max_pages) {
 		if (!capable(CAP_SYS_ADMIN) && nr_pages > pipe_max_pages) {
 			ret = -EPERM;
 			ret = -EPERM;
 			goto out;
 			goto out;
-		}
-
-		/*
-		 * The pipe needs to be at least 2 pages large to
-		 * guarantee POSIX behaviour.
-		 */
-		if (arg < 2) {
+		} else if (nr_pages < 1) {
 			ret = -EINVAL;
 			ret = -EINVAL;
 			goto out;
 			goto out;
 		}
 		}