Skip to content
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

assertion in debug mode when destroying zvol (#65) #15

Merged
merged 1 commit into from
Mar 16, 2018

Conversation

jkryl
Copy link

@jkryl jkryl commented Mar 15, 2018

The core of the change is about fixing references placed on spas from uzfs code. Each hold should have a unique tag because it is done on behalf of a different zvol (instead of a global tag). The other change is that the reference should not be bound to zinfo structure but rather to zvol_state structure, because that is the structure containing the actual spa reference. The code needs to be very clear in this regard.

Minor change bundled to this fix has been done to header and test files. It is not acceptable to define function in header files with different prototypes than real definitions in c files. And of course the c file which defines the functions needs to include the header file where the function is declared. That was quite messy and now that has been fixed.

Copy link

@vishnuitta vishnuitta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkryl why do we need this datatype change?

Copy link
Collaborator

@satbirchhikara satbirchhikara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making these changes.

@@ -323,6 +326,8 @@ uzfs_open_dataset_init(spa_t *spa, const char *ds_name, zvol_state_t **z)
disown_free:
dmu_objset_disown(zv->zv_objset, zv);
free_ret:
if (spa != NULL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we are here, we have spa non-null, so to me check is un-necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. thanks! I will fix it

@jkryl
Copy link
Author

jkryl commented Mar 15, 2018

@vishnuitta : we need data type change because if all spa, zvol, etc. pointers are declared as void pointers then compiler cannot check that we are passing the right pointer types to the functions. So basically it is about being able to uncover more bugs during compilation phase. More disastrous scenarios can happen if we mix data types which are more different (i.e. numeric types and pointers). And the c file which defines the functions must always include the prototypes from header file so that compiler can check that they are the same. If not that could lead to nasty bugs ...

Signed-off-by: Jan Kryl <jan.kryl@cloudbyte.com>
@vishnuitta
Copy link

@jkryl Idea of test framework was to go through uzfs_* APIs. If any functionality is required, those need to be provided from uzfs APIs so that zpool libraries become independent for making any testing tools.
So, with this void pointers, providing a layer of abstraction is the idea.

@vishnuitta
Copy link

any suggestions @gila , @satbirchhikara on ^^^ ??

@jkryl
Copy link
Author

jkryl commented Mar 16, 2018

Vitta, those header files are not consumed only by test libraries but also contain prototypes of functions used in production code. So all the possible inconsistencies which are very difficult to discover unless you include the header file in c file apply to production API as well. So firstly if this hack was done to solve some problem in test API then we need two header files, strictly decoupling production from test header file.

Secondly, I don't understand what abstraction layer we are trying to build here. What advantage does it have for our test code if for example instead of spa_t we can pass any pointer type? Everything in test library is then void * pointer and you can guess only by name what type of pointer it is. I don't see a single advantage of this approach.

@vishnuitta
Copy link

vishnuitta commented Mar 16, 2018

Got to see that these header files are used in production code also, which is not intended. We need to separate these header files for production and test code.
Abstraction in terms of test code will use uzfs_* APIs rather than variables from spa/zv.
Lets move ahead this PR, and decouple header files in next PR as this decoupling is not a priority item.

@jkryl
Copy link
Author

jkryl commented Mar 16, 2018

thanks Vitta

@jkryl jkryl merged commit 7444b88 into zfs-0.7-release Mar 16, 2018
@jkryl jkryl deleted the hold-tag branch March 16, 2018 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants