]> git.proxmox.com Git - mirror_zfs.git/commit
Fix snapshot automount behavior when concurrent or fail
authorChunwei Chen <david.chen@osnexus.com>
Tue, 17 Nov 2015 00:39:52 +0000 (16:39 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 19 Nov 2015 23:36:59 +0000 (15:36 -0800)
commitd287880afd843bd8c0cbcabe514b65083d1a0090
tree09baed813f48e8509c4b1f5d672bbec90bbeb000
parent5c790678f1a5231b75be174eb8a02e15dfe9b4d5
Fix snapshot automount behavior when concurrent or fail

When concurrent threads accessing the snapdir, one will succeed the user
helper mount while others will get EBUSY. However, the original code treats
those EBUSY threads as success and goes on to do zfsctl_snapshot_add, which
causes repeated avl_add and thus panic.

Also, if the snapshot is already mounted somewhere else, a thread accessing
the snapdir will also get EBUSY from user helper mount. And it will cause
strange things as doing follow_down_one will fail and then follow_up will jump
up to the mountpoint of the filesystem and confuse the hell out of VFS.

The patch fix both behavior by returning 0 immediately for the EBUSY threads.
Note, this will have a side effect for the second case where the VFS will
retry several times before returning ELOOP.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4018
module/zfs/zfs_ctldir.c