aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zpl_ctldir.c
diff options
context:
space:
mode:
authorNed Bass <[email protected]>2012-12-12 15:55:51 -0800
committerBrian Behlendorf <[email protected]>2012-12-13 08:57:11 -0800
commit7afcf5b1da83549bfba70a61fae7a00eaa63c2b0 (patch)
tree50234a20990c1ffc0106bda9d6e72de32fd08704 /module/zfs/zpl_ctldir.c
parent2ae10319624869eef0954cdfcdb6f5e33cba2e09 (diff)
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 <[email protected]> Closes #816
Diffstat (limited to 'module/zfs/zpl_ctldir.c')
-rw-r--r--module/zfs/zpl_ctldir.c7
1 files changed, 7 insertions, 0 deletions
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
@@ -357,6 +357,13 @@ zpl_snapdir_automount(struct path *path)
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
* the user space mount calls do_add_mount() which adds the vfsmount