Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751920AbdI0UOU (ORCPT ); Wed, 27 Sep 2017 16:14:20 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:46116 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbdI0UOR (ORCPT ); Wed, 27 Sep 2017 16:14:17 -0400 X-Google-Smtp-Source: AOwi7QAypce3GT01+ffiz4PAiPkxNmpfxBk+bytK4coaaS68xy/5A0keAbsYZWjXzNvB0j8cpHoK4g== From: Jens Axboe To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: hannes@cmpxchg.org, jack@suse.cz, torvalds@linux-foundation.org, Jens Axboe Subject: [PATCH 02/12] buffer: grow_dev_page() should use __GFP_NOFAIL for all cases Date: Wed, 27 Sep 2017 14:13:49 -0600 Message-Id: <1506543239-31470-3-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506543239-31470-1-git-send-email-axboe@kernel.dk> References: <1506543239-31470-1-git-send-email-axboe@kernel.dk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1092 Lines: 38 We currently it it for find_or_create_page(), which means that it cannot fail. Ensure we also pass in 'retry == true' to alloc_page_buffers(), which also ensure that it cannot fail. After this, there are no failure cases in grow_dev_page() that occur because of a failed memory allocation. Signed-off-by: Jens Axboe --- fs/buffer.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 1234ae343aef..3b60cd8456db 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -988,8 +988,6 @@ grow_dev_page(struct block_device *bdev, sector_t block, gfp_mask |= __GFP_NOFAIL; page = find_or_create_page(inode->i_mapping, index, gfp_mask); - if (!page) - return ret; BUG_ON(!PageLocked(page)); @@ -1008,9 +1006,7 @@ grow_dev_page(struct block_device *bdev, sector_t block, /* * Allocate some buffers for this page */ - bh = alloc_page_buffers(page, size, false); - if (!bh) - goto failed; + bh = alloc_page_buffers(page, size, true); /* * Link the page to the buffers and initialise them. Take the -- 2.7.4