From owner-dev-commits-src-branches@freebsd.org Fri Sep 17 01:39:23 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5D706AB659; Fri, 17 Sep 2021 01:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H9c7b6BpRz4dSH; Fri, 17 Sep 2021 01:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B495842D9; Fri, 17 Sep 2021 01:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18H1dNKG058515; Fri, 17 Sep 2021 01:39:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18H1dNdA058514; Fri, 17 Sep 2021 01:39:23 GMT (envelope-from git) Date: Fri, 17 Sep 2021 01:39:23 GMT Message-Id: <202109170139.18H1dNdA058514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 3c1c3728f32c - stable/12 - geli(8): Do not report error on resize to the same size. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3c1c3728f32cc71a3694f13be0610db5ff88519c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2021 01:39:24 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3c1c3728f32cc71a3694f13be0610db5ff88519c commit 3c1c3728f32cc71a3694f13be0610db5ff88519c Author: Alexander Motin AuthorDate: 2021-08-18 21:11:03 +0000 Commit: Alexander Motin CommitDate: 2021-09-17 01:39:21 +0000 geli(8): Do not report error on resize to the same size. Just validate the old metadata and exit. Originally the check was added to not thash the only copy of metadata, but we can achieve the same just by skipping the writing/trashing. The metadata validation should protect user from wrongly specifying new size instead of old. MFC after: 1 month Sponsored by: iXsystems, Inc. (cherry picked from commit c7cf100aafb4cb881e05a5153de152907f6c07f3) --- lib/geom/eli/geom_eli.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/geom/eli/geom_eli.c b/lib/geom/eli/geom_eli.c index f8d429e95b18..a89ac69cf338 100644 --- a/lib/geom/eli/geom_eli.c +++ b/lib/geom/eli/geom_eli.c @@ -1805,10 +1805,6 @@ eli_resize(struct gctl_req *req) gctl_error(req, "Invalid oldsize: Out of range."); goto out; } - if (oldsize == mediasize) { - gctl_error(req, "Size hasn't changed."); - goto out; - } /* Read metadata from the 'oldsize' offset. */ if (pread(provfd, sector, secsize, oldsize - secsize) != secsize) { @@ -1847,6 +1843,10 @@ eli_resize(struct gctl_req *req) goto out; } + /* The metadata is valid and nothing has changed. Just exit. */ + if (oldsize == mediasize) + goto out; + /* * Update the old metadata with the current provider size and write * it back to the correct place on the provider.