From 7afcf5b1da83549bfba70a61fae7a00eaa63c2b0 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Wed, 12 Dec 2012 15:55:51 -0800 Subject: [PATCH] Avoid ELOOP on auto-mounted snapshots 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. Signed-off-by: Brian Behlendorf Closes #816 --- module/zfs/zpl_ctldir.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/zfs/zpl_ctldir.c b/module/zfs/zpl_ctldir.c index 7dfaf6ebc..a2d8fa9fe 100644 --- a/module/zfs/zpl_ctldir.c +++ b/module/zfs/zpl_ctldir.c @@ -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 -- 2.40.0