Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5686906rwd; Mon, 12 Jun 2023 08:21:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CMoLZczk35HxqRvu9OygMyOrswoQaOiHWMi38dTsh3BSu6Xbn6eFd6iClKU6mkJ1Wn99y X-Received: by 2002:a17:903:2341:b0:1b2:28ca:d30 with SMTP id c1-20020a170903234100b001b228ca0d30mr8496692plh.10.1686583287565; Mon, 12 Jun 2023 08:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686583287; cv=none; d=google.com; s=arc-20160816; b=Lhbn14p3Z/Cdp1zt0imOPt/9uFcx679s44o1zf3e2kO8SKFfp2L/WFtSRNc3+luD2y g++zLxQbHZI2HVEGUfi4OTTLq0e8hmjD1Zv+uV4A3Fb8PVUx64iIE/XbufyOI79TnrpC cbRO/8u+B23HppRzkSd5boGeMVXjULwIc7P+qHi1ghCkXi7a1OFuI8lajMX5rhINA2cS Nru8A1Nv/cmFxcfZdndFIpuwSGHRxitSi2Cp/c61+n3Tgt7ljD5BuGl0w1bw7IbsROkz UzYmvFCzq/PHzsgN3+c+N/VFsF2yzi1bmeY3FkAWHs8zjOCKB+s1uGDJHRUCFLWa9gDZ rReA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PwbnNapXRdevBF0hfE35KqBRaBpKqJIqHALduY4qOvE=; b=tsXwQmR8bRnP1oTdotkIsee8zpd84NVdc2YGSqJwAk4SL9oul2vptn7XxI8ptf7TMY Ia2FKCK/AOUgFW0d9K0R4Uk+utOKMP2XldgybgjhBkO0oc2xrRabtV+HOE2heOjEhkYT M3q7ESoPFRDTDXsTVlN0/8/4UaUJcHrJnC+AubchXNhafPmati93VZfiiuBHu9Mb8uV4 sFqObEaOkfa9TCgBIrJOTiyevuEgwn/r2PagDhCxXBUGH0tZq3An3VZ5WqM/A1QumOCB Cs04kwxse+JAl/DYwwk2RH/VdmTzQb4Et/eNUkexAXpfg3+jJqjjHhrrOrXfpQi0jGDV 4Jpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=C7wViTvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a170903228300b001b06fa47440si7392355plh.352.2023.06.12.08.21.15; Mon, 12 Jun 2023 08:21:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=C7wViTvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238846AbjFLOeB (ORCPT + 99 others); Mon, 12 Jun 2023 10:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238827AbjFLOdn (ORCPT ); Mon, 12 Jun 2023 10:33:43 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87D8910D9; Mon, 12 Jun 2023 07:32:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PwbnNapXRdevBF0hfE35KqBRaBpKqJIqHALduY4qOvE=; b=C7wViTvphkn9dIMtH5VQREhMUv 1+E8O8JuhmHiYk+T16MMJqF/5v+zETwS4qWgZQ13Iy3fitgN+Qsx70hNBOJcF3Z1ZrUcIS/ol7AHQ E+wgpI0JDDsTgpeu07A5zlWT36Z2dhcbYcdjJMxUfz7cDnpognXwMNZmGzpoz1KO9VejzqKFfAxyS AjqgPBwN1pR1bBUcDcvUSNZ4xL37g4gTaCk3BT6JU3ZTLCFXz6E2K7PmKBczz+eDYrBC596zadpdL HNHKxVCFSCamSO+JSQsLkfdHzUYpwRIPqioTTKT8BKG1tlR/drnQiKyK2ajJ1DH+LA+ttEJeAM8Lb KkA/wExw==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q8ib4-004JET-0R; Mon, 12 Jun 2023 14:32:42 +0000 Date: Mon, 12 Jun 2023 07:32:42 -0700 From: Christoph Hellwig To: Sergei Shtepa Cc: axboe@kernel.dk, hch@infradead.org, corbet@lwn.net, snitzer@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, dchinner@redhat.com, willy@infradead.org, dlemoal@kernel.org, linux@weissschuh.net, jack@suse.cz, ming.lei@redhat.com, linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v5 00/11] blksnap - block devices snapshots module Message-ID: References: <20230612135228.10702-1-sergei.shtepa@veeam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230612135228.10702-1-sergei.shtepa@veeam.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm of course a little byassed by having spent a lot of my own time on this, but this version now looks ready to merge to me: Acked-by: Christoph Hellwig But as Jens just merged my series to reopen the open flag we'll also need to fold this in: diff --git a/drivers/block/blksnap/diff_area.c b/drivers/block/blksnap/diff_area.c index 169fa003b6d66d..0848c947591508 100644 --- a/drivers/block/blksnap/diff_area.c +++ b/drivers/block/blksnap/diff_area.c @@ -128,7 +128,7 @@ void diff_area_free(struct kref *kref) xa_destroy(&diff_area->chunk_map); if (diff_area->orig_bdev) { - blkdev_put(diff_area->orig_bdev, FMODE_READ | FMODE_WRITE); + blkdev_put(diff_area->orig_bdev, NULL); diff_area->orig_bdev = NULL; } @@ -214,7 +214,8 @@ struct diff_area *diff_area_new(dev_t dev_id, struct diff_storage *diff_storage) pr_debug("Open device [%u:%u]\n", MAJOR(dev_id), MINOR(dev_id)); - bdev = blkdev_get_by_dev(dev_id, FMODE_READ | FMODE_WRITE, NULL, NULL); + bdev = blkdev_get_by_dev(dev_id, BLK_OPEN_READ | BLK_OPEN_WRITE, NULL, + NULL); if (IS_ERR(bdev)) { int err = PTR_ERR(bdev); @@ -224,7 +225,7 @@ struct diff_area *diff_area_new(dev_t dev_id, struct diff_storage *diff_storage) diff_area = kzalloc(sizeof(struct diff_area), GFP_KERNEL); if (!diff_area) { - blkdev_put(bdev, FMODE_READ | FMODE_WRITE); + blkdev_put(bdev, NULL); return ERR_PTR(-ENOMEM); } diff --git a/drivers/block/blksnap/diff_storage.c b/drivers/block/blksnap/diff_storage.c index 1787fa6931a816..f3814474b9804a 100644 --- a/drivers/block/blksnap/diff_storage.c +++ b/drivers/block/blksnap/diff_storage.c @@ -123,7 +123,7 @@ void diff_storage_free(struct kref *kref) } while ((storage_bdev = first_storage_bdev(diff_storage))) { - blkdev_put(storage_bdev->bdev, FMODE_READ | FMODE_WRITE); + blkdev_put(storage_bdev->bdev, NULL); list_del(&storage_bdev->link); kfree(storage_bdev); } @@ -138,7 +138,7 @@ static struct block_device *diff_storage_add_storage_bdev( struct storage_bdev *storage_bdev, *existing_bdev = NULL; struct block_device *bdev; - bdev = blkdev_get_by_path(bdev_path, FMODE_READ | FMODE_WRITE, + bdev = blkdev_get_by_path(bdev_path, BLK_OPEN_READ | BLK_OPEN_WRITE, NULL, NULL); if (IS_ERR(bdev)) { pr_err("Failed to open device. errno=%ld\n", PTR_ERR(bdev)); @@ -153,14 +153,14 @@ static struct block_device *diff_storage_add_storage_bdev( spin_unlock(&diff_storage->lock); if (existing_bdev->bdev == bdev) { - blkdev_put(bdev, FMODE_READ | FMODE_WRITE); + blkdev_put(bdev, NULL); return existing_bdev->bdev; } storage_bdev = kzalloc(sizeof(struct storage_bdev) + strlen(bdev_path) + 1, GFP_KERNEL); if (!storage_bdev) { - blkdev_put(bdev, FMODE_READ | FMODE_WRITE); + blkdev_put(bdev, NULL); return ERR_PTR(-ENOMEM); }