Closed
Description
System information
Type | Version/Name |
---|---|
Distribution Name | Ubuntu |
Distribution Version | Ubuntu 18.04 |
Linux Kernel | 4.15.0-34-generic |
Architecture | x86_64 |
ZFS Version | v0.8.0-rc1 |
SPL Version | v0.8.0-rc1 |
Describe the problem you're observing
When multiple processes are concurrently modifying the /etc/dfs/sharetab
file (e.g. zfs set sharenfs=on ...
, zfs create -o sharenfs=on ...
, etc.) the contents of /etc/dfs/sharetab
can become "corrupt"; i.e. not all shared filesystems will be listed in that file.
Describe how to reproduce the problem
This can be reproduced with the following script:
#!/bin/bash
touch /etc/dfs/sharetab
echo -n "exportfs -- "; exportfs | wc -l
echo -n "sharetab -- "; cat /etc/dfs/sharetab | wc -l
for i in `seq 1 100`; do
(sleep 1; zfs create -o sharenfs=on tank/fs-$i) &
done
wait
echo -n "exportfs -- "; exportfs | wc -l
echo -n "sharetab -- "; cat /etc/dfs/sharetab | wc -l
When I run this script, I see the following:
$ sudo ./reproducer.sh
exportfs -- 0
sharetab -- 0
exportfs -- 100
sharetab -- 1
Here's some more information after running that reproducer:
$ sudo exportfs | head
/tank/fs-71 <world>
/tank/fs-42 <world>
/tank/fs-61 <world>
/tank/fs-48 <world>
/tank/fs-16 <world>
/tank/fs-40 <world>
/tank/fs-52 <world>
/tank/fs-80 <world>
/tank/fs-90 <world>
/tank/fs-57 <world>
$ sudo cat /etc/dfs/sharetab | head
/tank/fs-71 - nfs rw,crossmnt
$ sudo zfs list -r tank | head
NAME USED AVAIL REFER MOUNTPOINT
tank 3.80M 21.8G 30K /tank
tank/fs-1 24K 21.8G 24K /tank/fs-1
tank/fs-10 24K 21.8G 24K /tank/fs-10
tank/fs-100 24K 21.8G 24K /tank/fs-100
tank/fs-11 24K 21.8G 24K /tank/fs-11
tank/fs-12 24K 21.8G 24K /tank/fs-12
tank/fs-13 24K 21.8G 24K /tank/fs-13
tank/fs-14 24K 21.8G 24K /tank/fs-14
tank/fs-15 24K 21.8G 24K /tank/fs-15