-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Added a more descriptive error message due the destroy failure #17234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More detailed errors are always great, but I don't very like that additional details are not obtained atomically from the original error, but fetched separately, so they might be out of sync, theoretically confusing.
Also seems it failed to build:
Or in Clang:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with amotin about the non-atomicity of the change. Still I think this is a nice improvement, pointing at the hold will benefit users. On the net you'll find a lot of question asked by users confused by the fact they couldn't delete seemingly unused datasets.
As a side note, in this case I think it's OK not to indent the block contents since that would harm readability. What does checkstyle say, by the way?
On my side, the checkstyle was successful. |
@Artem-OSSRevival If you search for other examples, more typical is to open the braces at the end of |
Not exactly. Just search for ': {'. |
Yeah, I think this is the best solution. |
9586d14
to
f224564
Compare
Still looks good. |
To summarize, as initially written it required C23, starting with C99 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two commits should be merged.
ac1b039
to
a497c5f
Compare
lib/libzfs/libzfs_dataset.c
Outdated
@@ -4028,6 +4028,24 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer) | |||
dgettext(TEXT_DOMAIN, "snapshot is cloned")); | |||
ret = zfs_error(hdl, EZFS_EXISTS, errbuf); | |||
break; | |||
case EBUSY: { | |||
nvlist_t *existing_holds; | |||
lzc_get_holds(nvpair_name(pair), &existing_holds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking again, all other callers of lzc_get_holds()
check for possible errors. Without it you'll likely get some uninitialized memory dereference in nvlist_empty()
below.
ba86157
to
a497c5f
Compare
efe102f
to
a497c5f
Compare
Signed-off-by: Artem-OSSRevival <[email protected]>
Motivation and Context
Change improves interaction with the user. Makes an error message more understandable and descriptive.
#14538
Description
Previously, the destroy failure due to a long hold returned a standard error message:
dataset is busy
This could cause misunderstanding and confusion among users.
The change makes the error message more understandable and definite, displaying the presence of the holder.
This is implemented by performing an additional check for the presence of holders.
If any, displayed:
held by "holder"
instead ofdataset is busy
Before:
After:
How Has This Been Tested?
Run the commands in the different combinations.
Types of changes
Checklist:
Signed-off-by
.