Whamcloud - gitweb
LU-8174 misc: name open file handles as such 53/26953/17
authorAndreas Dilger <andreas.dilger@intel.com>
Fri, 8 May 2015 23:26:42 +0000 (17:26 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 5 Oct 2018 22:26:16 +0000 (22:26 +0000)
In a number of places in the code, rename variables from "*_handle"
or "*_fh" to "*_open_handle" so that it is clear this is referencing
an open file handle rather than something else (e.g. a lock handle).

Also rename the confusingly-named mti_close_handle to mti_open_handle,
since this is referencing an open file handle, even if it is used at
close time to close the file.

   mfd_handle2mfd() -> mfd_open_handle2mfd()
   mdt_file_data.mfd_handle -> mfd_open_handle
   mdt_file_data.mfd_old_handle -> mfd_open_handle_old
   mdt_thread_info.mti_close_handle -> mti_open_handle
   mdt_body.mbo_handle -> mbo_open_handle
   mdt_io_epoch.mio_handle -> mio_open_handle
   md_op_data.op_handle -> op_open_handle
   mdt_rec_create.cr_old_handle -> cr_open_handle_old
   mdt_reint_record.rr_handle -> rr_open_handle
   obd_client_handle.och_fh -> och_open_handle

Change the resync code path to use a "lease_handle" to avoid confusion
with an open handle:

   mdt_rec_resync.rs_handle -> rs_lease_handle
   use md_op_data.op_lease_handle
   add mdt_reint_record.rr_lease_handle

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I6e2abdaee1c32d502ea4f2f4b339a6bb21528f69
Reviewed-on: https://review.whamcloud.com/26953
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
16 files changed:
lustre/include/obd.h
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/mdc/mdc_lib.c
lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_open.c
lustre/mdt/mdt_reint.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 20d9773..99c46a1 100644 (file)
@@ -828,7 +828,7 @@ struct md_op_data {
        struct lu_fid           op_fid4; /* to the operation locks. */
        u32                     op_mds;  /* what mds server open will go to */
        __u32                   op_mode;
-       struct lustre_handle    op_handle;
+       struct lustre_handle    op_open_handle;
        s64                     op_mod_time;
        const char              *op_name;
        size_t                  op_namelen;
@@ -1023,7 +1023,7 @@ struct md_open_data {
 };
 
 struct obd_client_handle {
-       struct lustre_handle     och_fh;
+       struct lustre_handle     och_open_handle;
        struct lu_fid            och_fid;
        struct md_open_data     *och_mod;
        struct lustre_handle     och_lease_handle; /* open lock for lease */
index a600a39..9a8963a 100644 (file)
@@ -1802,7 +1802,7 @@ enum md_transient_state {
 struct mdt_body {
        struct lu_fid mbo_fid1;
        struct lu_fid mbo_fid2;
-       struct lustre_handle mbo_handle;
+       struct lustre_handle mbo_open_handle;
        __u64   mbo_valid;
        __u64   mbo_size; /* Offset, in the case of MDS_READPAGE */
        __s64   mbo_mtime;
@@ -1839,7 +1839,7 @@ struct mdt_body {
 }; /* 216 */
 
 struct mdt_ioepoch {
-       struct lustre_handle mio_handle;
+       struct lustre_handle mio_open_handle;
        __u64 mio_unused1; /* was ioepoch */
        __u32 mio_unused2; /* was flags */
        __u32 mio_padding;
@@ -1934,32 +1934,32 @@ enum mds_op_bias {
 
 /* instance of mdt_reint_rec */
 struct mdt_rec_create {
-        __u32           cr_opcode;
-        __u32           cr_cap;
-        __u32           cr_fsuid;
-        __u32           cr_fsuid_h;
-        __u32           cr_fsgid;
-        __u32           cr_fsgid_h;
-        __u32           cr_suppgid1;
-        __u32           cr_suppgid1_h;
-        __u32           cr_suppgid2;
-        __u32           cr_suppgid2_h;
-        struct lu_fid   cr_fid1;
-        struct lu_fid   cr_fid2;
-        struct lustre_handle cr_old_handle; /* handle in case of open replay */
+       __u32           cr_opcode;
+       __u32           cr_cap;
+       __u32           cr_fsuid;
+       __u32           cr_fsuid_h;
+       __u32           cr_fsgid;
+       __u32           cr_fsgid_h;
+       __u32           cr_suppgid1;
+       __u32           cr_suppgid1_h;
+       __u32           cr_suppgid2;
+       __u32           cr_suppgid2_h;
+       struct lu_fid   cr_fid1;
+       struct lu_fid   cr_fid2;
+       struct lustre_handle cr_open_handle_old; /* in case of open replay */
        __s64           cr_time;
-        __u64           cr_rdev;
-        __u64           cr_ioepoch;
-        __u64           cr_padding_1;   /* rr_blocks */
-        __u32           cr_mode;
-        __u32           cr_bias;
-        /* use of helpers set/get_mrc_cr_flags() is needed to access
-         * 64 bits cr_flags [cr_flags_l, cr_flags_h], this is done to
-         * extend cr_flags size without breaking 1.8 compat */
-        __u32           cr_flags_l;     /* for use with open, low  32 bits  */
-        __u32           cr_flags_h;     /* for use with open, high 32 bits */
-        __u32           cr_umask;       /* umask for create */
-        __u32           cr_padding_4;   /* rr_padding_4 */
+       __u64           cr_rdev;
+       __u64           cr_ioepoch;
+       __u64           cr_padding_1;   /* rr_blocks */
+       __u32           cr_mode;
+       __u32           cr_bias;
+       /* use of helpers set/get_mrc_cr_flags() is needed to access
+        * 64 bits cr_flags [cr_flags_l, cr_flags_h], this is done to
+        * extend cr_flags size without breaking 1.8 compat */
+       __u32           cr_flags_l;     /* for use with open, low  32 bits  */
+       __u32           cr_flags_h;     /* for use with open, high 32 bits */
+       __u32           cr_umask;       /* umask for create */
+       __u32           cr_padding_4;   /* rr_padding_4 */
 };
 
 /* instance of mdt_reint_rec */
@@ -2087,7 +2087,7 @@ struct mdt_rec_resync {
        __u32           rs_suppgid2_h;
        struct lu_fid   rs_fid;
        __u8            rs_padding0[sizeof(struct lu_fid)];
-       struct lustre_handle rs_handle; /* rr_mtime */
+       struct lustre_handle rs_lease_handle;   /* rr_mtime */
        __s64           rs_padding1;    /* rr_atime */
        __s64           rs_padding2;    /* rr_ctime */
        __u64           rs_padding3;    /* rr_size */
index 16fb348..0481138 100644 (file)
@@ -106,7 +106,7 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data,
        op_data->op_attr_flags = ll_inode_to_ext_flags(inode->i_flags);
        if (ll_file_test_flag(ll_i2info(inode), LLIF_PROJECT_INHERIT))
                op_data->op_attr_flags |= LUSTRE_PROJINHERIT_FL;
-       op_data->op_handle = och->och_fh;
+       op_data->op_open_handle = och->och_open_handle;
 
        if (och->och_flags & FMODE_WRITE &&
            ll_file_test_and_clear_flag(ll_i2info(inode), LLIF_DATA_MODIFIED))
@@ -224,7 +224,7 @@ static int ll_close_inode_openhandle(struct inode *inode,
 out:
 
        md_clear_open_replay_data(md_exp, och);
-       och->och_fh.cookie = DEAD_HANDLE_MAGIC;
+       och->och_open_handle.cookie = DEAD_HANDLE_MAGIC;
        OBD_FREE_PTR(och);
 
        ptlrpc_req_finished(req);       /* This is close request */
@@ -596,7 +596,7 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
        struct mdt_body *body;
 
        body = req_capsule_server_get(&it->it_request->rq_pill, &RMF_MDT_BODY);
-       och->och_fh = body->mbo_handle;
+       och->och_open_handle = body->mbo_open_handle;
        och->och_fid = body->mbo_fid1;
        och->och_lease_handle.cookie = it->it_lock_handle;
        och->och_magic = OBD_CLIENT_HANDLE_MAGIC;
@@ -873,7 +873,7 @@ static int ll_md_blocking_lease_ast(struct ldlm_lock *lock,
  * if it has an open lock in cache already.
  */
 static int ll_lease_och_acquire(struct inode *inode, struct file *file,
-                               struct lustre_handle *old_handle)
+                               struct lustre_handle *old_open_handle)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
@@ -906,7 +906,7 @@ static int ll_lease_och_acquire(struct inode *inode, struct file *file,
                *och_p = NULL;
        }
 
-       *old_handle = fd->fd_och->och_fh;
+       *old_open_handle = fd->fd_och->och_open_handle;
 
        EXIT;
 out_unlock:
@@ -967,7 +967,7 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct md_op_data *op_data;
        struct ptlrpc_request *req = NULL;
-       struct lustre_handle old_handle = { 0 };
+       struct lustre_handle old_open_handle = { 0 };
        struct obd_client_handle *och = NULL;
        int rc;
        int rc2;
@@ -980,7 +980,7 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
                if (!(fmode & file->f_mode) || (file->f_mode & FMODE_EXEC))
                        RETURN(ERR_PTR(-EPERM));
 
-               rc = ll_lease_och_acquire(inode, file, &old_handle);
+               rc = ll_lease_och_acquire(inode, file, &old_open_handle);
                if (rc)
                        RETURN(ERR_PTR(rc));
        }
@@ -995,7 +995,7 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
                GOTO(out, rc = PTR_ERR(op_data));
 
        /* To tell the MDT this openhandle is from the same owner */
-       op_data->op_handle = old_handle;
+       op_data->op_open_handle = old_open_handle;
 
        it.it_flags = fmode | open_flags;
        it.it_flags |= MDS_OPEN_LOCK | MDS_OPEN_BY_FID | MDS_OPEN_LEASE;
@@ -1194,7 +1194,7 @@ static int ll_lease_file_resync(struct obd_client_handle *och,
        if (rc)
                GOTO(out, rc);
 
-       op_data->op_handle = och->och_lease_handle;
+       op_data->op_lease_handle = och->och_lease_handle;
        rc = md_file_resync(sbi->ll_md_exp, op_data);
        if (rc)
                GOTO(out, rc);
@@ -4224,7 +4224,7 @@ again:
                if (rc != 0)
                        GOTO(out_close, rc);
 
-               op_data->op_handle = och->och_fh;
+               op_data->op_open_handle = och->och_open_handle;
                op_data->op_data_version = data_version;
                op_data->op_lease_handle = och->och_lease_handle;
                op_data->op_bias |= MDS_CLOSE_MIGRATE;
@@ -4249,7 +4249,7 @@ again:
                        obd_mod_put(och->och_mod);
                        md_clear_open_replay_data(ll_i2sbi(parent)->ll_md_exp,
                                                  och);
-                       och->och_fh.cookie = DEAD_HANDLE_MAGIC;
+                       och->och_open_handle.cookie = DEAD_HANDLE_MAGIC;
                        OBD_FREE_PTR(och);
                        och = NULL;
                }
index 2988cc2..868c340 100644 (file)
@@ -2351,7 +2351,7 @@ void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req)
        }
 
        op_data->op_fid1 = body->mbo_fid1;
-       op_data->op_handle = body->mbo_handle;
+       op_data->op_open_handle = body->mbo_open_handle;
        op_data->op_mod_time = ktime_get_real_seconds();
        md_close(exp, op_data, NULL, &close_req);
        ptlrpc_req_finished(close_req);
index 2481e63..2429c1e 100644 (file)
@@ -263,7 +263,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
                rec->cr_suppgid1   = op_data->op_suppgids[0];
                rec->cr_suppgid2   = op_data->op_suppgids[1];
                rec->cr_bias       = op_data->op_bias;
-               rec->cr_old_handle = op_data->op_handle;
+               rec->cr_open_handle_old = op_data->op_open_handle;
 
                if (op_data->op_name) {
                        mdc_pack_name(req, &RMF_NAME, op_data->op_name,
@@ -367,7 +367,7 @@ static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec,
 static void mdc_ioepoch_pack(struct mdt_ioepoch *epoch,
                             struct md_op_data *op_data)
 {
-       epoch->mio_handle = op_data->op_handle;
+       epoch->mio_open_handle = op_data->op_open_handle;
        epoch->mio_unused1 = 0;
        epoch->mio_unused2 = 0;
        epoch->mio_padding = 0;
index ae15cda..e0a97b1 100644 (file)
@@ -463,9 +463,9 @@ int mdc_file_resync(struct obd_export *exp, struct md_op_data *op_data)
        rec->rs_fid     = op_data->op_fid1;
        rec->rs_bias    = op_data->op_bias;
 
-       lock = ldlm_handle2lock(&op_data->op_handle);
+       lock = ldlm_handle2lock(&op_data->op_lease_handle);
        if (lock != NULL) {
-               rec->rs_handle = lock->l_remote_handle;
+               rec->rs_lease_handle = lock->l_remote_handle;
                LDLM_LOCK_PUT(lock);
        }
 
index 67c6291..3de6d18 100644 (file)
@@ -588,41 +588,41 @@ int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md)
 
 void mdc_replay_open(struct ptlrpc_request *req)
 {
-        struct md_open_data *mod = req->rq_cb_data;
-        struct ptlrpc_request *close_req;
-        struct obd_client_handle *och;
-        struct lustre_handle old;
-        struct mdt_body *body;
-        ENTRY;
+       struct md_open_data *mod = req->rq_cb_data;
+       struct ptlrpc_request *close_req;
+       struct obd_client_handle *och;
+       struct lustre_handle old_open_handle = { };
+       struct mdt_body *body;
+       ENTRY;
 
-        if (mod == NULL) {
-                DEBUG_REQ(D_ERROR, req,
-                          "Can't properly replay without open data.");
-                EXIT;
-                return;
-        }
+       if (mod == NULL) {
+               DEBUG_REQ(D_ERROR, req,
+                         "Can't properly replay without open data.");
+               EXIT;
+               return;
+       }
 
-        body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
-        LASSERT(body != NULL);
+       body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
+       LASSERT(body != NULL);
 
        spin_lock(&req->rq_lock);
        och = mod->mod_och;
-       if (och && och->och_fh.cookie)
+       if (och && och->och_open_handle.cookie)
                req->rq_early_free_repbuf = 1;
        else
                req->rq_early_free_repbuf = 0;
        spin_unlock(&req->rq_lock);
 
        if (req->rq_early_free_repbuf) {
-               struct lustre_handle *file_fh;
+               struct lustre_handle *file_open_handle;
 
                LASSERT(och->och_magic == OBD_CLIENT_HANDLE_MAGIC);
 
-               file_fh = &och->och_fh;
+               file_open_handle = &och->och_open_handle;
                CDEBUG(D_HA, "updating handle from %#llx to %#llx\n",
-                      file_fh->cookie, body->mbo_handle.cookie);
-               old = *file_fh;
-               *file_fh = body->mbo_handle;
+                      file_open_handle->cookie, body->mbo_open_handle.cookie);
+               old_open_handle = *file_open_handle;
+               *file_open_handle = body->mbo_open_handle;
        }
 
        close_req = mod->mod_close_req;
@@ -636,10 +636,11 @@ void mdc_replay_open(struct ptlrpc_request *req)
                LASSERT(epoch);
 
                if (req->rq_early_free_repbuf)
-                       LASSERT(!memcmp(&old, &epoch->mio_handle, sizeof(old)));
+                       LASSERT(old_open_handle.cookie ==
+                               epoch->mio_open_handle.cookie);
 
                DEBUG_REQ(D_HA, close_req, "updating close body with new fh");
-               epoch->mio_handle = body->mbo_handle;
+               epoch->mio_open_handle = body->mbo_open_handle;
        }
        EXIT;
 }
@@ -721,19 +722,20 @@ int mdc_set_open_replay_data(struct obd_export *exp,
                open_req->rq_commit_cb = mdc_commit_open;
                open_req->rq_early_free_repbuf = 1;
                spin_unlock(&open_req->rq_lock);
-        }
+       }
 
        rec->cr_fid2 = body->mbo_fid1;
-       rec->cr_old_handle.cookie = body->mbo_handle.cookie;
+       rec->cr_open_handle_old = body->mbo_open_handle;
        open_req->rq_replay_cb = mdc_replay_open;
        if (!fid_is_sane(&body->mbo_fid1)) {
-                DEBUG_REQ(D_ERROR, open_req, "Saving replay request with "
-                          "insane fid");
-                LBUG();
-        }
+               DEBUG_REQ(D_ERROR, open_req,
+                         "saving replay request with insane FID " DFID,
+                         PFID(&body->mbo_fid1));
+               LBUG();
+       }
 
-        DEBUG_REQ(D_RPCTRACE, open_req, "Set up open replay data");
-        RETURN(0);
+       DEBUG_REQ(D_RPCTRACE, open_req, "Set up open replay data");
+       RETURN(0);
 }
 
 static void mdc_free_open(struct md_open_data *mod)
@@ -777,7 +779,7 @@ int mdc_clear_open_replay_data(struct obd_export *exp,
 
        spin_lock(&mod->mod_open_req->rq_lock);
        if (mod->mod_och)
-               mod->mod_och->och_fh.cookie = 0;
+               mod->mod_och->och_open_handle.cookie = 0;
        mod->mod_open_req->rq_early_free_repbuf = 0;
        spin_unlock(&mod->mod_open_req->rq_lock);
        mdc_free_open(mod);
index 8607b23..080dc19 100644 (file)
@@ -66,7 +66,6 @@
 
 #include "mdt_internal.h"
 
-
 static unsigned int max_mod_rpcs_per_client = 8;
 module_param(max_mod_rpcs_per_client, uint, 0644);
 MODULE_PARM_DESC(max_mod_rpcs_per_client, "maximum number of modify RPCs in flight allowed per client");
@@ -5703,7 +5702,7 @@ static int mdt_export_cleanup(struct obd_export *exp)
 
                /* Remove mfd handle so it can't be found again.
                 * We are consuming the mfd_list reference here. */
-               class_handle_unhash(&mfd->mfd_handle);
+               class_handle_unhash(&mfd->mfd_open_handle);
                list_move_tail(&mfd->mfd_list, &closing_list);
        }
        spin_unlock(&med->med_open_lock);
index ddd73f7..f78a67e 100644 (file)
@@ -65,7 +65,7 @@ struct mdt_object;
 /* file data for open files on MDS */
 struct mdt_file_data {
        /**  portals handle must be first */
-       struct portals_handle   mfd_handle;
+       struct portals_handle   mfd_open_handle;
        /** open mode provided by client */
        __u64                   mfd_mode;
        /** protected by med_open_lock */
@@ -73,7 +73,7 @@ struct mdt_file_data {
        /** xid of the open request */
        __u64                   mfd_xid;
        /** old handle in replay case */
-       struct lustre_handle    mfd_old_handle;
+       struct lustre_handle    mfd_open_handle_old;
        /** point to opened object */
        struct mdt_object       *mfd_object;
 };
@@ -351,7 +351,8 @@ enum {
 
 struct mdt_reint_record {
        enum mds_reint_op                rr_opcode;
-       const struct lustre_handle      *rr_handle;
+       const struct lustre_handle      *rr_open_handle;
+       const struct lustre_handle      *rr_lease_handle;
        const struct lu_fid             *rr_fid1;
        const struct lu_fid             *rr_fid2;
        struct lu_name                   rr_name;
@@ -481,10 +482,10 @@ struct mdt_thread_info {
                } som;
        } mti_u;
 
-       struct lustre_handle       mti_close_handle;
-       loff_t                     mti_off;
-       struct lu_buf              mti_buf;
-       struct lu_buf              mti_big_buf;
+       struct lustre_handle       mti_open_handle;
+       loff_t                     mti_off;
+       struct lu_buf              mti_buf;
+       struct lu_buf              mti_big_buf;
 
         /* Ops object filename */
         struct lu_name             mti_name;
@@ -821,11 +822,11 @@ void mdt_mfd_set_mode(struct mdt_file_data *mfd,
                      __u64 mode);
 
 int mdt_reint_open(struct mdt_thread_info *info,
-                   struct mdt_lock_handle *lhc);
+                  struct mdt_lock_handle *lhc);
 
-struct mdt_file_data *mdt_handle2mfd(struct mdt_export_data *med,
-                                    const struct lustre_handle *handle,
-                                    bool is_replay);
+struct mdt_file_data *mdt_open_handle2mfd(struct mdt_export_data *med,
+                                       const struct lustre_handle *open_handle,
+                                       bool is_replay);
 
 int mdt_get_info(struct tgt_session_info *tsi);
 int mdt_attr_get_complex(struct mdt_thread_info *info,
index 8b53d43..a948042 100644 (file)
@@ -1129,7 +1129,7 @@ static int mdt_close_handle_unpack(struct mdt_thread_info *info)
        if (ioepoch == NULL)
                RETURN(-EPROTO);
 
-       info->mti_close_handle = ioepoch->mio_handle;
+       info->mti_open_handle = ioepoch->mio_open_handle;
 
        RETURN(0);
 }
@@ -1550,18 +1550,18 @@ static int mdt_open_unpack(struct mdt_thread_info *info)
        uc->uc_suppgids[1] = rec->cr_suppgid2;
        uc->uc_umask = rec->cr_umask;
 
-        rr->rr_fid1   = &rec->cr_fid1;
-        rr->rr_fid2   = &rec->cr_fid2;
-        rr->rr_handle = &rec->cr_old_handle;
-        attr->la_mode = rec->cr_mode;
-        attr->la_rdev  = rec->cr_rdev;
-        attr->la_uid   = rec->cr_fsuid;
-        attr->la_gid   = rec->cr_fsgid;
-        attr->la_ctime = rec->cr_time;
-        attr->la_mtime = rec->cr_time;
-        attr->la_atime = rec->cr_time;
-        attr->la_valid = LA_MODE  | LA_RDEV  | LA_UID   | LA_GID |
-                         LA_CTIME | LA_MTIME | LA_ATIME;
+       rr->rr_fid1   = &rec->cr_fid1;
+       rr->rr_fid2   = &rec->cr_fid2;
+       rr->rr_open_handle = &rec->cr_open_handle_old;
+       attr->la_mode = rec->cr_mode;
+       attr->la_rdev  = rec->cr_rdev;
+       attr->la_uid   = rec->cr_fsuid;
+       attr->la_gid   = rec->cr_fsgid;
+       attr->la_ctime = rec->cr_time;
+       attr->la_mtime = rec->cr_time;
+       attr->la_atime = rec->cr_time;
+       attr->la_valid = LA_MODE  | LA_RDEV  | LA_UID   | LA_GID |
+                        LA_CTIME | LA_MTIME | LA_ATIME;
         memset(&info->mti_spec.u, 0, sizeof(info->mti_spec.u));
         info->mti_spec.sp_cr_flags = get_mrc_cr_flags(rec);
         /* Do not trigger ASSERTION if client miss to set such flags. */
@@ -1683,8 +1683,8 @@ static int mdt_resync_unpack(struct mdt_thread_info *info)
         * in lustre_swab_mdt_rec_reint() as rr_mtime, so here it needs
         * restoring. */
        if (ptlrpc_req_need_swab(mdt_info_req(info)))
-               __swab64s(&rec->rs_handle.cookie);
-       rr->rr_handle = &rec->rs_handle;
+               __swab64s(&rec->rs_lease_handle.cookie);
+       rr->rr_lease_handle = &rec->rs_lease_handle;
 
        RETURN(mdt_dlmreq_unpack(info));
 }
index bf4dc12..cc0faf9 100644 (file)
@@ -49,7 +49,7 @@ static void mdt_mfd_get(void *mfdp)
 {
 }
 
-static struct portals_handle_ops mfd_handle_ops = {
+static struct portals_handle_ops mfd_open_handle_ops = {
        .hop_addref = mdt_mfd_get,
        .hop_free   = NULL,
 };
@@ -63,10 +63,10 @@ struct mdt_file_data *mdt_mfd_new(const struct mdt_export_data *med)
 
        OBD_ALLOC_PTR(mfd);
        if (mfd != NULL) {
-               INIT_LIST_HEAD(&mfd->mfd_handle.h_link);
-               mfd->mfd_handle.h_owner = med;
+               INIT_LIST_HEAD(&mfd->mfd_open_handle.h_link);
+               mfd->mfd_open_handle.h_owner = med;
                INIT_LIST_HEAD(&mfd->mfd_list);
-               class_handle_hash(&mfd->mfd_handle, &mfd_handle_ops);
+               class_handle_hash(&mfd->mfd_open_handle, &mfd_open_handle_ops);
        }
 
        RETURN(mfd);
@@ -78,19 +78,20 @@ struct mdt_file_data *mdt_mfd_new(const struct mdt_export_data *med)
  * but mfd can be found in mfd list by that handle.
  * Callers need to be holding med_open_lock.
  */
-struct mdt_file_data *mdt_handle2mfd(struct mdt_export_data *med,
-                                    const struct lustre_handle *handle,
-                                    bool is_replay_or_resent)
+struct mdt_file_data *mdt_open_handle2mfd(struct mdt_export_data *med,
+                                       const struct lustre_handle *open_handle,
+                                       bool is_replay_or_resent)
 {
        struct mdt_file_data   *mfd;
        ENTRY;
 
-       LASSERT(handle != NULL);
-       mfd = class_handle2object(handle->cookie, med);
+       LASSERT(open_handle != NULL);
+       mfd = class_handle2object(open_handle->cookie, med);
        /* during dw/setattr replay the mfd can be found by old handle */
        if (mfd == NULL && is_replay_or_resent) {
                list_for_each_entry(mfd, &med->med_open_head, mfd_list) {
-                       if (mfd->mfd_old_handle.cookie == handle->cookie)
+                       if (mfd->mfd_open_handle_old.cookie ==
+                           open_handle->cookie)
                                RETURN(mfd);
                }
                mfd = NULL;
@@ -103,7 +104,7 @@ struct mdt_file_data *mdt_handle2mfd(struct mdt_export_data *med,
 void mdt_mfd_free(struct mdt_file_data *mfd)
 {
        LASSERT(list_empty(&mfd->mfd_list));
-       OBD_FREE_RCU(mfd, sizeof *mfd, &mfd->mfd_handle);
+       OBD_FREE_RCU(mfd, sizeof *mfd, &mfd->mfd_open_handle);
 }
 
 static int mdt_create_data(struct mdt_thread_info *info,
@@ -437,15 +438,16 @@ static int mdt_mfd_open(struct mdt_thread_info *info, struct mdt_object *p,
                 * might be disconnected from server, and
                 * restart replay, so there maybe some orphan
                 * mfd here, we should remove them */
-               LASSERT(info->mti_rr.rr_handle != NULL);
+               LASSERT(info->mti_rr.rr_open_handle != NULL);
                spin_lock(&med->med_open_lock);
-               old_mfd = mdt_handle2mfd(med, info->mti_rr.rr_handle, true);
+               old_mfd = mdt_open_handle2mfd(med, info->mti_rr.rr_open_handle,
+                                             true);
                if (old_mfd != NULL) {
                        CDEBUG(D_HA, "delete orphan mfd = %p, fid = "DFID", "
                               "cookie = %#llx\n", mfd,
                               PFID(mdt_object_fid(mfd->mfd_object)),
-                              info->mti_rr.rr_handle->cookie);
-                       class_handle_unhash(&old_mfd->mfd_handle);
+                              info->mti_rr.rr_open_handle->cookie);
+                       class_handle_unhash(&old_mfd->mfd_open_handle);
                        list_del_init(&old_mfd->mfd_list);
                        spin_unlock(&med->med_open_lock);
                        /* no attr update for that close */
@@ -460,20 +462,20 @@ static int mdt_mfd_open(struct mdt_thread_info *info, struct mdt_object *p,
                        CDEBUG(D_HA, "orphan mfd not found, fid = "DFID", "
                               "cookie = %#llx\n",
                               PFID(mdt_object_fid(mfd->mfd_object)),
-                              info->mti_rr.rr_handle->cookie);
+                              info->mti_rr.rr_open_handle->cookie);
                }
 
                CDEBUG(D_HA, "Store old cookie %#llx in new mfd\n",
-                      info->mti_rr.rr_handle->cookie);
+                      info->mti_rr.rr_open_handle->cookie);
 
-               mfd->mfd_old_handle.cookie = info->mti_rr.rr_handle->cookie;
+               mfd->mfd_open_handle_old = *info->mti_rr.rr_open_handle;
        }
 
-       repbody->mbo_handle.cookie = mfd->mfd_handle.h_cookie;
+       repbody->mbo_open_handle.cookie = mfd->mfd_open_handle.h_cookie;
 
        if (req->rq_export->exp_disconnected) {
                spin_lock(&med->med_open_lock);
-               class_handle_unhash(&mfd->mfd_handle);
+               class_handle_unhash(&mfd->mfd_open_handle);
                list_del_init(&mfd->mfd_list);
                spin_unlock(&med->med_open_lock);
                mdt_mfd_close(info, mfd);
@@ -606,8 +608,9 @@ static int mdt_finish_open(struct mdt_thread_info *info,
                }
                spin_unlock(&med->med_open_lock);
 
-                if (mfd != NULL) {
-                       repbody->mbo_handle.cookie = mfd->mfd_handle.h_cookie;
+               if (mfd != NULL) {
+                       repbody->mbo_open_handle.cookie =
+                               mfd->mfd_open_handle.h_cookie;
                        /* set repbody->ea_size for resent case */
                        if (ma->ma_valid & MA_LOV) {
                                LASSERT(ma->ma_lmm_size != 0);
@@ -965,11 +968,11 @@ static int mdt_object_open_lock(struct mdt_thread_info *info,
                is_replay_or_resent = req_is_replay(req) ||
                        lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT;
 
-               /* if the request is _not_ a replay request, rr_handle
-                * may be used to hold an openhandle which is issuing the
+               /* if the request is _not_ a replay request, rr_open_handle
+                * may be used to hold an open file handle which is issuing the
                 * lease request, so that this openhandle doesn't count. */
-               mfd = mdt_handle2mfd(med, info->mti_rr.rr_handle,
-                                    is_replay_or_resent);
+               mfd = mdt_open_handle2mfd(med, info->mti_rr.rr_open_handle,
+                                         is_replay_or_resent);
                if (mfd != NULL)
                        ++open_count;
 
@@ -2339,16 +2342,17 @@ int mdt_close_internal(struct mdt_thread_info *info, struct ptlrpc_request *req,
 
        med = &req->rq_export->exp_mdt_data;
        spin_lock(&med->med_open_lock);
-       mfd = mdt_handle2mfd(med, &info->mti_close_handle, req_is_replay(req));
+       mfd = mdt_open_handle2mfd(med, &info->mti_open_handle,
+                                 req_is_replay(req));
        if (mdt_mfd_closed(mfd)) {
                spin_unlock(&med->med_open_lock);
                CDEBUG(D_INODE, "no handle for file close: fid = "DFID
                       ": cookie = %#llx\n", PFID(info->mti_rr.rr_fid1),
-                      info->mti_close_handle.cookie);
+                      info->mti_open_handle.cookie);
                /** not serious error since bug 3633 */
                rc = -ESTALE;
        } else {
-               class_handle_unhash(&mfd->mfd_handle);
+               class_handle_unhash(&mfd->mfd_open_handle);
                list_del_init(&mfd->mfd_list);
                spin_unlock(&med->med_open_lock);
                ret = mdt_mfd_close(info, mfd);
@@ -2399,9 +2403,9 @@ int mdt_close(struct tgt_session_info *tsi)
                ma->ma_need = MA_INODE | MA_LOV;
                repbody->mbo_eadatasize = 0;
                repbody->mbo_aclsize = 0;
-        } else {
-                rc = err_serious(rc);
-        }
+       } else {
+               rc = err_serious(rc);
+       }
 
        rc = mdt_close_internal(info, req, repbody);
        if (rc != -ESTALE)
index cb77f69..895fb90 100644 (file)
@@ -2661,7 +2661,7 @@ static int mdt_reint_resync(struct mdt_thread_info *info,
        if (mdt_object_remote(mo))
                GOTO(out_obj, rc = -EREMOTE);
 
-       lease = ldlm_handle2lock(rr->rr_handle);
+       lease = ldlm_handle2lock(rr->rr_lease_handle);
        if (lease == NULL)
                GOTO(out_obj, rc = -ESTALE);
 
index e9205ee..21b2c20 100644 (file)
@@ -1899,7 +1899,7 @@ void lustre_swab_mdt_body (struct mdt_body *b)
 
 void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b)
 {
-       /* mio_handle is opaque */
+       /* mio_open_handle is opaque */
        CLASSERT(offsetof(typeof(*b), mio_unused1) != 0);
        CLASSERT(offsetof(typeof(*b), mio_unused2) != 0);
        CLASSERT(offsetof(typeof(*b), mio_padding) != 0);
index 056d130..aea5302 100644 (file)
@@ -2298,10 +2298,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_body, mbo_fid2));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_body *)0)->mbo_fid2));
-       LASSERTF((int)offsetof(struct mdt_body, mbo_handle) == 32, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_body, mbo_handle));
-       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_handle));
+       LASSERTF((int)offsetof(struct mdt_body, mbo_open_handle) == 32, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_body, mbo_open_handle));
+       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_open_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_open_handle));
        LASSERTF((int)offsetof(struct mdt_body, mbo_valid) == 40, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_body, mbo_valid));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_valid) == 8, "found %lld\n",
@@ -2500,10 +2500,10 @@ void lustre_assert_wire_constants(void)
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct mdt_ioepoch));
-       LASSERTF((int)offsetof(struct mdt_ioepoch, mio_handle) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_ioepoch, mio_handle));
-       LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_ioepoch *)0)->mio_handle));
+       LASSERTF((int)offsetof(struct mdt_ioepoch, mio_open_handle) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_ioepoch, mio_open_handle));
+       LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_open_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_ioepoch *)0)->mio_open_handle));
        LASSERTF((int)offsetof(struct mdt_ioepoch, mio_unused1) == 8, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_ioepoch, mio_unused1));
        LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_unused1) == 8, "found %lld\n",
@@ -2672,10 +2672,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_rec_create, cr_fid2));
        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_fid2));
-       LASSERTF((int)offsetof(struct mdt_rec_create, cr_old_handle) == 72, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_rec_create, cr_old_handle));
-       LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_old_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_old_handle));
+       LASSERTF((int)offsetof(struct mdt_rec_create, cr_open_handle_old) == 72, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_rec_create, cr_open_handle_old));
+       LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_open_handle_old) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_open_handle_old));
        LASSERTF((int)offsetof(struct mdt_rec_create, cr_time) == 80, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_rec_create, cr_time));
        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_time) == 8, "found %lld\n",
index 8bd3da7..203f367 100644 (file)
@@ -1059,7 +1059,7 @@ check_mdt_body(void)
        CHECK_STRUCT(mdt_body);
        CHECK_MEMBER(mdt_body, mbo_fid1);
        CHECK_MEMBER(mdt_body, mbo_fid2);
-       CHECK_MEMBER(mdt_body, mbo_handle);
+       CHECK_MEMBER(mdt_body, mbo_open_handle);
        CHECK_MEMBER(mdt_body, mbo_valid);
        CHECK_MEMBER(mdt_body, mbo_size);
        CHECK_MEMBER(mdt_body, mbo_mtime);
@@ -1139,7 +1139,7 @@ check_mdt_ioepoch(void)
 {
        BLANK_LINE();
        CHECK_STRUCT(mdt_ioepoch);
-       CHECK_MEMBER(mdt_ioepoch, mio_handle);
+       CHECK_MEMBER(mdt_ioepoch, mio_open_handle);
        CHECK_MEMBER(mdt_ioepoch, mio_unused1);
        CHECK_MEMBER(mdt_ioepoch, mio_unused2);
        CHECK_MEMBER(mdt_ioepoch, mio_padding);
@@ -1194,7 +1194,7 @@ check_mdt_rec_create(void)
        CHECK_MEMBER(mdt_rec_create, cr_suppgid2_h);
        CHECK_MEMBER(mdt_rec_create, cr_fid1);
        CHECK_MEMBER(mdt_rec_create, cr_fid2);
-       CHECK_MEMBER(mdt_rec_create, cr_old_handle);
+       CHECK_MEMBER(mdt_rec_create, cr_open_handle_old);
        CHECK_MEMBER(mdt_rec_create, cr_time);
        CHECK_MEMBER(mdt_rec_create, cr_rdev);
        CHECK_MEMBER(mdt_rec_create, cr_ioepoch);
index f2bbe03..38ea6ef 100644 (file)
@@ -2319,10 +2319,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_body, mbo_fid2));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_body *)0)->mbo_fid2));
-       LASSERTF((int)offsetof(struct mdt_body, mbo_handle) == 32, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_body, mbo_handle));
-       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_handle));
+       LASSERTF((int)offsetof(struct mdt_body, mbo_open_handle) == 32, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_body, mbo_open_handle));
+       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_open_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_open_handle));
        LASSERTF((int)offsetof(struct mdt_body, mbo_valid) == 40, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_body, mbo_valid));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_valid) == 8, "found %lld\n",
@@ -2521,10 +2521,10 @@ void lustre_assert_wire_constants(void)
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct mdt_ioepoch));
-       LASSERTF((int)offsetof(struct mdt_ioepoch, mio_handle) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_ioepoch, mio_handle));
-       LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_ioepoch *)0)->mio_handle));
+       LASSERTF((int)offsetof(struct mdt_ioepoch, mio_open_handle) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_ioepoch, mio_open_handle));
+       LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_open_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_ioepoch *)0)->mio_open_handle));
        LASSERTF((int)offsetof(struct mdt_ioepoch, mio_unused1) == 8, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_ioepoch, mio_unused1));
        LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_unused1) == 8, "found %lld\n",
@@ -2693,10 +2693,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_rec_create, cr_fid2));
        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_fid2));
-       LASSERTF((int)offsetof(struct mdt_rec_create, cr_old_handle) == 72, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_rec_create, cr_old_handle));
-       LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_old_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_old_handle));
+       LASSERTF((int)offsetof(struct mdt_rec_create, cr_open_handle_old) == 72, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_rec_create, cr_open_handle_old));
+       LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_open_handle_old) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_open_handle_old));
        LASSERTF((int)offsetof(struct mdt_rec_create, cr_time) == 80, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_rec_create, cr_time));
        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_time) == 8, "found %lld\n",