Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Sep 2021 01:39:09 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c8f2af5f5d1f - stable/13 - geli(8): Do not report error on resize to the same size.
Message-ID:  <202109170139.18H1d9gG058384@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=c8f2af5f5d1fff0212c18d876acc79ffc17178c8

commit c8f2af5f5d1fff0212c18d876acc79ffc17178c8
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-08-18 21:11:03 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-09-17 01:39:07 +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 8ee4643e3c91..4c04a9256b5e 100644
--- a/lib/geom/eli/geom_eli.c
+++ b/lib/geom/eli/geom_eli.c
@@ -1823,10 +1823,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) {
@@ -1865,6 +1861,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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109170139.18H1d9gG058384>