Skip to content

Commit

Permalink
Avoid ELOOP on auto-mounted snapshots
Browse files Browse the repository at this point in the history
Ensure that the path member pointers are associated with the
newly-mounted snapshot when zpl_snapdir_automount() returns.  Otherwise
the follow_automount() function may be called repeatedly, leading to an
incorrect ELOOP error return. This problem was observed as a 'Too many
levels of symbolic links' error from user-space commands accessing an
unmounted snapshot in the .zfs/snapshot directory.

Issue openzfs#816
  • Loading branch information
nedbass committed Dec 13, 2012
1 parent 2ae1031 commit 8fbf971
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions module/zfs/zpl_ctldir.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ zpl_snapdir_automount(struct path *path)
if (error)
return ERR_PTR(error);

/*
* Ensure path->dentry points to the dentry for the root of the
* newly-mounted snapshot, otherwise this function may be called
* repeatedly which can lead to an incorrect ELOOP error return.
*/
follow_up(path);

/*
* Rather than returning the new vfsmount for the snapshot we must
* return NULL to indicate a mount collision. This is done because
Expand Down

0 comments on commit 8fbf971

Please sign in to comment.