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.
This commit is contained in:
parent
c261b6ea4e
commit
c7cf100aaf
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user