mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Make rollbacks fail gracefully
Support for rolling back datasets require a functional ZPL, which we currently do not have. The zfs command does not check for ZPL support before attempting a rollback, and in preparation for rolling back a zvol it removes the minor node of the device. To prevent the zvol device node from disappearing after a failed rollback operation, this change wraps the zfs_do_rollback() function in an #ifdef HAVE_ZPL and returns ENOSYS in the absence of a ZPL. This is consistent with the behavior of other ZPL dependent commands such as mount. The orginal error message observed with this bug was rather confusing: internal error: Unknown error 524 Aborted This was because zfs_ioc_rollback() returns ENOTSUP if we don't HAVE_ZPL, but Linux actually has no such error code. It should instead return EOPNOTSUPP, as that is how ENOTSUP is defined in user space. With that we would have gotten the somewhat more helpful message cannot rollback 'tank/fish': unsupported version This is rather a moot point with the above changes since we will no longer make that ioctl call without a ZPL. But, this change updates the error code just in case. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
7e55f4e00c
commit
3ee56c292b
@ -2340,6 +2340,7 @@ typedef struct rollback_cbdata {
|
|||||||
* 'cb_dependent' is set, then this is a dependent and we should report it
|
* 'cb_dependent' is set, then this is a dependent and we should report it
|
||||||
* without checking the transaction group.
|
* without checking the transaction group.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
static int
|
static int
|
||||||
rollback_check(zfs_handle_t *zhp, void *data)
|
rollback_check(zfs_handle_t *zhp, void *data)
|
||||||
{
|
{
|
||||||
@ -2399,10 +2400,12 @@ rollback_check(zfs_handle_t *zhp, void *data)
|
|||||||
zfs_close(zhp);
|
zfs_close(zhp);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ZPL */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
zfs_do_rollback(int argc, char **argv)
|
zfs_do_rollback(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ZPL
|
||||||
int ret;
|
int ret;
|
||||||
int c;
|
int c;
|
||||||
boolean_t force = B_FALSE;
|
boolean_t force = B_FALSE;
|
||||||
@ -2484,6 +2487,9 @@ out:
|
|||||||
return (0);
|
return (0);
|
||||||
else
|
else
|
||||||
return (1);
|
return (1);
|
||||||
|
#else
|
||||||
|
return ENOSYS;
|
||||||
|
#endif /*HAVE_ZPL*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3291,7 +3291,7 @@ out:
|
|||||||
dsl_dataset_rele(ds, FTAG);
|
dsl_dataset_rele(ds, FTAG);
|
||||||
return (error);
|
return (error);
|
||||||
#else
|
#else
|
||||||
return (ENOTSUP);
|
return (EOPNOTSUPP);
|
||||||
#endif /* HAVE_ZPL */
|
#endif /* HAVE_ZPL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user