if (IS_ERR_OR_NULL(result))
                return ERR_PTR(-ESTALE);
 
+       /*
+        * If no acceptance criteria was specified by caller, a disconnected
+        * dentry is also accepatable. Callers may use this mode to query if
+        * file handle is stale or to get a reference to an inode without
+        * risking the high overhead caused by directory reconnect.
+        */
+       if (!acceptable)
+               return result;
+
        if (d_is_dir(result)) {
                /*
                 * This request is for a directory.
 
        if (!ofs->upper_mnt)
                return ERR_PTR(-EACCES);
 
-       upper = ovl_decode_real_fh(fh, ofs->upper_mnt);
+       upper = ovl_decode_real_fh(fh, ofs->upper_mnt, true);
        if (IS_ERR_OR_NULL(upper))
                return upper;
 
        }
 
        /* Then lookup origin by fh */
-       err = ovl_check_origin_fh(ofs, fh, NULL, &stack);
+       err = ovl_check_origin_fh(ofs, fh, true, NULL, &stack);
        if (err) {
                goto out_err;
        } else if (index) {
 
        goto out;
 }
 
-struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt)
+struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt,
+                                 bool connected)
 {
        struct dentry *real;
        int bytes;
        bytes = (fh->len - offsetof(struct ovl_fh, fid));
        real = exportfs_decode_fh(mnt, (struct fid *)fh->fid,
                                  bytes >> 2, (int)fh->type,
-                                 ovl_acceptable, mnt);
+                                 connected ? ovl_acceptable : NULL, mnt);
        if (IS_ERR(real)) {
                /*
                 * Treat stale file handle to lower file as "origin unknown".
 }
 
 
-int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh,
+int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected,
                        struct dentry *upperdentry, struct ovl_path **stackp)
 {
        struct dentry *origin = NULL;
        int i;
 
        for (i = 0; i < ofs->numlower; i++) {
-               origin = ovl_decode_real_fh(fh, ofs->lower_layers[i].mnt);
+               origin = ovl_decode_real_fh(fh, ofs->lower_layers[i].mnt,
+                                           connected);
                if (origin)
                        break;
        }
        if (IS_ERR_OR_NULL(fh))
                return PTR_ERR(fh);
 
-       err = ovl_check_origin_fh(ofs, fh, upperdentry, stackp);
+       err = ovl_check_origin_fh(ofs, fh, false, upperdentry, stackp);
        kfree(fh);
 
        if (err) {
        if (IS_ERR_OR_NULL(fh))
                return ERR_CAST(fh);
 
-       upper = ovl_decode_real_fh(fh, ofs->upper_mnt);
+       upper = ovl_decode_real_fh(fh, ofs->upper_mnt, true);
        kfree(fh);
 
        if (IS_ERR_OR_NULL(upper))
 
        /* Check if non-dir index is orphan and don't warn before cleaning it */
        if (!d_is_dir(index) && d_inode(index)->i_nlink == 1) {
-               err = ovl_check_origin_fh(ofs, fh, index, &stack);
+               err = ovl_check_origin_fh(ofs, fh, false, index, &stack);
                if (err)
                        goto fail;
 
 
 
 /* namei.c */
 int ovl_check_fh_len(struct ovl_fh *fh, int fh_len);
-struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt);
-int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh,
+struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt,
+                                 bool connected);
+int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected,
                        struct dentry *upperdentry, struct ovl_path **stackp);
 int ovl_verify_set_fh(struct dentry *dentry, const char *name,
                      struct dentry *real, bool is_upper, bool set);