From f3f0c589c32a0f3321d37cbf046e0a32881bff4b Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Thu, 19 May 2016 17:04:27 -0700 Subject: [PATCH] Skip ctldir znode in zfs_rezget to fix snapdir issues Skip ctldir in zfs_rezget, otherwise they will always get invalidated. This will cause funny behaviour for the mounted snapdirs. Especially for Linux >= 3.18, d_invalidate will detach the mountpoint and prevent anyone automount it again as long as someone is still using the detached mount. Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #4514 Closes #4661 Closes #4672 --- module/zfs/zfs_znode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index abfb50e63b..c478b36f1a 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -1147,6 +1147,16 @@ zfs_rezget(znode_t *zp) uint64_t gen; znode_hold_t *zh; + /* + * skip ctldir, otherwise they will always get invalidated. This will + * cause funny behaviour for the mounted snapdirs. Especially for + * Linux >= 3.18, d_invalidate will detach the mountpoint and prevent + * anyone automount it again as long as someone is still using the + * detached mount. + */ + if (zp->z_is_ctldir) + return (0); + zh = zfs_znode_hold_enter(zsb, obj_num); mutex_enter(&zp->z_acl_lock);