Commit aa2f4a3f authored by wang di's avatar wang di Committed by Greg Kroah-Hartman

staging: lustre: llite: root inode checking for migration

Do not migrate root inode.
Signed-off-by: default avatarwang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7577
Reviewed-on: http://review.whamcloud.com/17669Reviewed-by: default avatarLai Siyao <lai.siyao@intel.com>
Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b0a17f5
...@@ -2626,18 +2626,18 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, ...@@ -2626,18 +2626,18 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
ll_get_fsname(parent->i_sb, NULL, 0), name, ll_get_fsname(parent->i_sb, NULL, 0), name,
PFID(&op_data->op_fid3)); PFID(&op_data->op_fid3));
rc = -EINVAL; rc = -EINVAL;
goto out_free; goto out_unlock;
} }
rc = ll_get_mdt_idx_by_fid(ll_i2sbi(parent), &op_data->op_fid3); rc = ll_get_mdt_idx_by_fid(ll_i2sbi(parent), &op_data->op_fid3);
if (rc < 0) if (rc < 0)
goto out_free; goto out_unlock;
if (rc == mdtidx) { if (rc == mdtidx) {
CDEBUG(D_INFO, "%s:"DFID" is already on MDT%d.\n", name, CDEBUG(D_INFO, "%s:"DFID" is already on MDT%d.\n", name,
PFID(&op_data->op_fid3), mdtidx); PFID(&op_data->op_fid3), mdtidx);
rc = 0; rc = 0;
goto out_free; goto out_unlock;
} }
again: again:
if (S_ISREG(child_inode->i_mode)) { if (S_ISREG(child_inode->i_mode)) {
...@@ -2645,13 +2645,13 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, ...@@ -2645,13 +2645,13 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
if (IS_ERR(och)) { if (IS_ERR(och)) {
rc = PTR_ERR(och); rc = PTR_ERR(och);
och = NULL; och = NULL;
goto out_free; goto out_unlock;
} }
rc = ll_data_version(child_inode, &data_version, rc = ll_data_version(child_inode, &data_version,
LL_DV_WR_FLUSH); LL_DV_WR_FLUSH);
if (rc) if (rc)
goto out_free; goto out_close;
op_data->op_handle = och->och_fh; op_data->op_handle = och->och_fh;
op_data->op_data = och->och_mod; op_data->op_data = och->och_mod;
...@@ -2671,12 +2671,12 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, ...@@ -2671,12 +2671,12 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY); body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
if (!body) { if (!body) {
rc = -EPROTO; rc = -EPROTO;
goto out_free; goto out_close;
} }
/* /*
* If the server does release layout lock, then we cleanup * If the server does release layout lock, then we cleanup
* the client och here, otherwise release it in out_free: * the client och here, otherwise release it in out_close:
*/ */
if (och && body->mbo_valid & OBD_MD_CLOSE_INTENT_EXECED) { if (och && body->mbo_valid & OBD_MD_CLOSE_INTENT_EXECED) {
obd_mod_put(och->och_mod); obd_mod_put(och->och_mod);
...@@ -2694,15 +2694,15 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, ...@@ -2694,15 +2694,15 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
request = NULL; request = NULL;
goto again; goto again;
} }
out_free: out_close:
if (child_inode) {
if (och) /* close the file */ if (och) /* close the file */
ll_lease_close(och, child_inode, NULL); ll_lease_close(och, child_inode, NULL);
if (!rc)
clear_nlink(child_inode); clear_nlink(child_inode);
out_unlock:
inode_unlock(child_inode); inode_unlock(child_inode);
iput(child_inode); iput(child_inode);
} out_free:
ll_finish_md_op_data(op_data); ll_finish_md_op_data(op_data);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment