HomeFreeBSD

gfs_lookup_dot() does not have to acquire any locks

Description

gfs_lookup_dot() does not have to acquire any locks

In fact, that was dangerous. For example, zfsctl_snapshot_reclaim()
calls gfs_dir_lookup() on ".." path and that ends up calling
gfs_lookup_dot() which violated locking order by acquiring the parent's
directory vnode lock after the child's vnode lock.

Also, the previous behavior was inconsistent as gfs_dir_lookup()
returned a locked vnode for . and .. lookups, but not for any other.

Now gfs_lookup_dot() just references a resulting vnode and the locking
is done in its consumers, where necessary.
Note that we do not enable shared locking support for any gfs / zfsctl
vnodes.

This commit partially reverts r273641.

MFC after: 5 weeks

Details

Provenance
avgAuthored on
Parents
rS299945: avoid deadlock between zfsctl_snapdir_lookup and zfsctl_snapshot_reclaim
Branches
Unknown
Tags
Unknown