Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3503666pxb; Mon, 24 Jan 2022 10:56:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzs1aTKNnhEzPLOn54JguD83IaJ4fDgsfJcwea5igQEnQwH7XcVAax+GDxMjulzy6rGnf2k X-Received: by 2002:a17:902:ce84:b0:14b:4bc6:e73 with SMTP id f4-20020a170902ce8400b0014b4bc60e73mr6174881plg.130.1643050578384; Mon, 24 Jan 2022 10:56:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050578; cv=none; d=google.com; s=arc-20160816; b=yh6UxGM7oDL2OHdRPG/upr73M8RlX7dhKFUjNp6naZi4jEH03AO7KGSzuIusO1/CMK ZWthgkaQs/Ovu77CMs8dAxB0SUUQI+Z/kV+1suVdACvdK9xN5ZBnvPm3KsT2LVR0UZwB hGZ1yRKRcfR0eLO8V+/G7EobSd/KQ47Bfch8/NeRBEntDZ/dUT7FAwG5q91hvsGczYIO hmxbIQIXJPbxR2hK1nDbdr+K4iXqTjMrhxdDuNPmihLdHMOofa7hFrk5RVsgFPtWTQ7i rH8iiCp9upCnQD8ljZ7R+TRPvl/g0q9LhBxknYViMlVRHxtcPeHJs+/l5vWtUxNij1qL O5Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zt4z0CCqxTu0ALe3IrRHpwIG3ETXoc3mZtIYo6QdQDM=; b=PxDeE6/ppHe8JRuJ60RtxipCmtSl0RE/b63GgMOeUl8hgRN6tYkFrZHKrYa+S3vnvL eARBvDRH7tuWSnMJK6dP7vq7zQ+xvDUx2Ti6qpjO1pW/4af+I48lvLHApjVBI4nZLWW3 cIYhDhyHpDh+o4JGzN8/ZvuIPPuJCesPtrRym98e4aONT58yWYZJ3ya1o3g5KKIZ/JG9 WHeN6bZsWkWZTmbRuEwz8HYSt38wF/PB7pO//s1xRmWdOH7NcDKhbF9AEdPjk9rYz5kX PImpiM55VKKCtIiReStCTtqZG9K0CnQi3lsRQdBTyv88x+LSz85OHf7ilXY/WKm82Yyi eQSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=s3e61xH6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si7109048plp.594.2022.01.24.10.56.05; Mon, 24 Jan 2022 10:56:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=s3e61xH6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236519AbiAXJLo (ORCPT + 99 others); Mon, 24 Jan 2022 04:11:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242617AbiAXJLl (ORCPT ); Mon, 24 Jan 2022 04:11:41 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 779A4C061744; Mon, 24 Jan 2022 01:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=zt4z0CCqxTu0ALe3IrRHpwIG3ETXoc3mZtIYo6QdQDM=; b=s3e61xH669mdB88dsM0ako/6hm YsdPOFv/+9bUrCprVe09zHwO1lKRo1xqZckfy+k3aI4O7evk+RiB0/o5y50HMgqybj6V8nydnHaqX mtMq31ULR3tuFniaKuzrkBKWQ9GLcEOIxcmh7CseGdVBvrlGNE+yQfMA1Ozavs6cDairUaII9NR8y ph4Ax4aY8fmmukVLpqEVBHr+JV24FvfuqKG6PehkdijYQ2882QgOVHZuvUklnkTyQ1NRkwXensI+H fb2buJqmJs6jYMIPQO5OmkHhgR28rV4GqNdGzaVKM7k+in5ebCQTHOLDzcJGZZNvSIJF2PMIzPxhK 4yVDZYeA==; Received: from [2001:4bb8:184:72a4:a337:a75f:a24e:7e39] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBvNu-002kBG-B5; Mon, 24 Jan 2022 09:11:34 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Pavel Begunkov , Mike Snitzer , Ryusuke Konishi , Konstantin Komarov , Andrew Morton , "Md . Haris Iqbal " , Jack Wang , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Philipp Reisner , Lars Ellenberg , linux-block@vger.kernel.org, dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ntfs3@lists.linux.dev, xen-devel@lists.xenproject.org, drbd-dev@lists.linbit.com Subject: [PATCH 09/19] drbd: bio_alloc can't fail if it is allow to sleep Date: Mon, 24 Jan 2022 10:10:57 +0100 Message-Id: <20220124091107.642561-10-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124091107.642561-1-hch@lst.de> References: <20220124091107.642561-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Remove handling of NULL returns from sleeping bio_alloc calls given that those can't fail. Signed-off-by: Christoph Hellwig --- drivers/block/drbd/drbd_receiver.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 6df2539e215ba..fb59b263deeef 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -1281,14 +1281,13 @@ static void submit_one_flush(struct drbd_device *device, struct issue_flush_cont { struct bio *bio = bio_alloc(GFP_NOIO, 0); struct one_flush_context *octx = kmalloc(sizeof(*octx), GFP_NOIO); - if (!bio || !octx) { - drbd_warn(device, "Could not allocate a bio, CANNOT ISSUE FLUSH\n"); + + if (!octx) { + drbd_warn(device, "Could not allocate a octx, CANNOT ISSUE FLUSH\n"); /* FIXME: what else can I do now? disconnecting or detaching * really does not help to improve the state of the world, either. */ - kfree(octx); - if (bio) - bio_put(bio); + bio_put(bio); ctx->error = -ENOMEM; put_ldev(device); @@ -1646,7 +1645,6 @@ int drbd_submit_peer_request(struct drbd_device *device, unsigned data_size = peer_req->i.size; unsigned n_bios = 0; unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT; - int err = -ENOMEM; /* TRIM/DISCARD: for now, always use the helper function * blkdev_issue_zeroout(..., discard=true). @@ -1688,10 +1686,6 @@ int drbd_submit_peer_request(struct drbd_device *device, */ next_bio: bio = bio_alloc(GFP_NOIO, nr_pages); - if (!bio) { - drbd_err(device, "submit_ee: Allocation of a bio failed (nr_pages=%u)\n", nr_pages); - goto fail; - } /* > peer_req->i.sector, unless this is the first bio */ bio->bi_iter.bi_sector = sector; bio_set_dev(bio, device->ldev->backing_bdev); @@ -1726,14 +1720,6 @@ int drbd_submit_peer_request(struct drbd_device *device, drbd_submit_bio_noacct(device, fault_type, bio); } while (bios); return 0; - -fail: - while (bios) { - bio = bios; - bios = bios->bi_next; - bio_put(bio); - } - return err; } static void drbd_remove_epoch_entry_interval(struct drbd_device *device, -- 2.30.2