* If \a bias is MDS_CLOSE_LAYOUT_SWAP then \a data is a pointer to the inode to
  * swap layouts with.
  */
-static int ll_close_inode_openhandle(struct obd_export *md_exp,
+static int ll_close_inode_openhandle(struct inode *inode,
                                     struct obd_client_handle *och,
-                                    struct inode *inode,
                                     enum mds_op_bias bias,
                                     void *data)
 {
        const struct ll_inode_info *lli = ll_i2info(inode);
+       struct obd_export *md_exp = ll_i2mdexp(inode);
        struct md_op_data *op_data;
        struct ptlrpc_request *req = NULL;
        int rc;
                /* There might be a race and this handle may already
                 * be closed.
                 */
-               rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
-                                              och, inode, 0, NULL);
+               rc = ll_close_inode_openhandle(inode, och, 0, NULL);
        }
 
        return rc;
 }
 
-static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
-                      struct file *file)
+static int ll_md_close(struct inode *inode, struct file *file)
 {
        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
        struct ll_inode_info *lli = ll_i2info(inode);
        }
 
        if (fd->fd_och) {
-               rc = ll_close_inode_openhandle(md_exp, fd->fd_och, inode, 0,
-                                              NULL);
+               rc = ll_close_inode_openhandle(inode, fd->fd_och, 0, NULL);
                fd->fd_och = NULL;
                goto out;
        }
        }
        mutex_unlock(&lli->lli_och_mutex);
 
-       if (!md_lock_match(md_exp, flags, ll_inode2fid(inode),
+       if (!md_lock_match(ll_i2mdexp(inode), flags, ll_inode2fid(inode),
                           LDLM_IBITS, &policy, lockmode, &lockh))
                rc = ll_md_real_close(inode, fd->fd_omode);
 
                lli->lli_async_rc = 0;
        }
 
-       rc = ll_md_close(sbi->ll_md_exp, inode, file);
+       rc = ll_md_close(inode, file);
 
        if (CFS_FAIL_TIMEOUT_MS(OBD_FAIL_PTLRPC_DUMP_LOG, cfs_fail_val))
                libcfs_debug_dumplog();
                it.it_lock_mode = 0;
                och->och_lease_handle.cookie = 0ULL;
        }
-       rc2 = ll_close_inode_openhandle(sbi->ll_md_exp, och, inode, 0, NULL);
+       rc2 = ll_close_inode_openhandle(inode, och, 0, NULL);
        if (rc2 < 0)
                CERROR("%s: error closing file "DFID": %d\n",
                       ll_get_fsname(inode->i_sb, NULL, 0),
         * NB: lease lock handle is released in mdc_close_layout_swap_pack()
         * because we still need it to pack l_remote_handle to MDT.
         */
-       rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, och, inode,
-                                      MDS_CLOSE_LAYOUT_SWAP, inode2);
+       rc = ll_close_inode_openhandle(inode, och, MDS_CLOSE_LAYOUT_SWAP,
+                                      inode2);
 
        och = NULL; /* freed in ll_close_inode_openhandle() */
 
        if (lease_broken)
                *lease_broken = cancelled;
 
-       return ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
-                                        och, inode, 0, NULL);
+       return ll_close_inode_openhandle(inode, och, 0, NULL);
 }
 
 int ll_merge_attr(const struct lu_env *env, struct inode *inode)
 
        ll_och_fill(ll_i2sbi(inode)->ll_md_exp, it, och);
 
-       rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
-                                      och, inode, 0, NULL);
+       rc = ll_close_inode_openhandle(inode, och, 0, NULL);
 out:
        /* this one is in place of ll_file_open */
        if (it_disposition(it, DISP_ENQ_OPEN_REF)) {
         * NB: lease lock handle is released in mdc_hsm_release_pack() because
         * we still need it to pack l_remote_handle to MDT.
         */
-       rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, och, inode,
-                                      MDS_HSM_RELEASE, &data_version);
+       rc = ll_close_inode_openhandle(inode, och, MDS_HSM_RELEASE,
+                                      &data_version);
        och = NULL;
 
 out: