libzfs: zfs_unshare: minor cleanup
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13165
This commit is contained in:
parent
88d5580e51
commit
1ec9218faa
|
@ -797,20 +797,15 @@ zfs_unshare(zfs_handle_t *zhp, const char *mountpoint,
|
||||||
{
|
{
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
struct mnttab entry;
|
struct mnttab entry;
|
||||||
const char *mntpt = NULL;
|
|
||||||
|
|
||||||
if (proto == NULL)
|
if (proto == NULL)
|
||||||
proto = share_all_proto;
|
proto = share_all_proto;
|
||||||
|
|
||||||
/* check to see if need to unmount the filesystem */
|
|
||||||
if (mountpoint != NULL)
|
|
||||||
mntpt = mountpoint;
|
|
||||||
|
|
||||||
if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
|
if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
|
||||||
libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) {
|
libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) {
|
||||||
|
|
||||||
if (mountpoint == NULL)
|
/* check to see if need to unmount the filesystem */
|
||||||
mntpt = entry.mnt_mountp;
|
const char *mntpt = mountpoint ?: entry.mnt_mountp;
|
||||||
|
|
||||||
for (const enum sa_protocol *curr_proto = proto;
|
for (const enum sa_protocol *curr_proto = proto;
|
||||||
*curr_proto != SA_NO_PROTOCOL; curr_proto++)
|
*curr_proto != SA_NO_PROTOCOL; curr_proto++)
|
||||||
|
|
Loading…
Reference in New Issue