Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

9880 Race in ZFS parallel mount #700

Closed
wants to merge 1 commit into from

Conversation

citrus-it
Copy link

@citrus-it citrus-it commented Oct 10, 2018

There is a race condition in the ZFS parallel mount code which shows up if you have zoned datasets with the same mountpoint as those in the global zone. The code makes the incorrect assumption that mount points are globally unique. This results in mount failures during boot or pool import.

Take the following set of filesystems which have been sorted by mountpoint by the existing code - mountpoints followed by the dataset in brackets. The letters at the left are my annotations.

With this set of filesystems, zfs_foreach_mountpoint() will create tasks a-h, task g will create A-D and D will create s-z. The problem is that, for example, t can run before B.

a   / (rpool/ROOT/r151024l)
b   / (rpool/ROOT/r151028.pre2)
c   / (rpool/ROOT/r151026.l1tf)
d   /data (data/zone/build/export)
e   /data (data/zone/reci/export)
f   /data (data)
g   /data (data/zone/ns1/export)
 A  /data/sendmail (data/zone/build/export/sendmail)
 B  /data/sendmail (data/sendmail)
 C  /data/sendmail (data/zone/ns1/export/sendmail)
 D  /data/sendmail (data/zone/reci/export/sendmail)
  s /data/sendmail/clientmqueue (data/zone/reci/export/sendmail/clientmqueue)
  t /data/sendmail/clientmqueue (data/sendmail/clientmqueue)
  u /data/sendmail/clientmqueue (data/zone/ns1/export/sendmail/clientmqueue)
  v /data/sendmail/clientmqueue (data/zone/build/export/sendmail/clientmqueue)
  w /data/sendmail/mqueue (data/zone/ns1/export/sendmail/mqueue)
  x /data/sendmail/mqueue (data/zone/build/export/sendmail/mqueue)
  y /data/sendmail/mqueue (data/sendmail/mqueue)
  z /data/sendmail/mqueue (data/zone/reci/export/sendmail/mqueue)
h   /home (data/home)
 Z  /home/af (data/home/af)

The fix I've gone for at the moment is to change the sort so that filesystems with the zoned attribute are sorted to the bottom. In the global zone, that results in the expected sorted list of filesystems and has the additional benefit that we can stop creating tasks once we see a zoned filesystem in the list. In a non-global zone, only the delegated filesystems are seen so the list is just traversed as normal.

@citrus-it citrus-it changed the title Race in ZFS parallel mount 9880 Race in ZFS parallel mount Oct 10, 2018
Copy link

@jasonbking jasonbking left a comment

Choose a reason for hiding this comment

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

Just two cstyle nits, otherwise looks good.

usr/src/lib/libzfs/common/libzfs_mount.c Outdated Show resolved Hide resolved
usr/src/lib/libzfs/common/libzfs_mount.c Outdated Show resolved Hide resolved
@ahrens
Copy link
Member

ahrens commented Oct 10, 2018

@sebroy could you take a look if you have time?

@citrus-it
Copy link
Author

@sebroy - it would be great if you could have a look please. I'm hoping to get this integrated in time for the next OmniOS and OpenIndiana release/snapshot - if necessary I can take it through review and RTI myself on the illumos side.

TIA.

@citrus-it
Copy link
Author

Shall I submit this for RTI? I know that OpenIndiana want it too before preparing their October snapshot.

@prakashsurya
Copy link
Member

@citrus-it sure, you can RTI this.

@citrus-it
Copy link
Author

citrus-it commented Oct 20, 2018

Sent for RTI

@prakashsurya
Copy link
Member

Thanks. I can approve if nobody else does in the next day or so.

@citrus-it citrus-it closed this Oct 21, 2018
@citrus-it citrus-it deleted the oz_parallel branch October 21, 2018 09:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants