提交 3c8fb1b1 编写于 作者: F Fan Yong 提交者: Greg Kroah-Hartman

staging: lustre: statahead: set sai_index_wait with lli_sa_lock held

It is the sponsor thread of the statahead thread to update the
sai::sai_index_wait. Originally, it didn't hold the lli_sa_lock
when did that. Becuase of out-of-order execution others may miss
to wakeup such thread.

On the other hand, if the statahead RPC gets failure, it should
wakeup the sponsor thread, not the statahead thread.
Signed-off-by: NLi Xi <lixi@ddn.com>
Signed-off-by: NFan Yong <fan.yong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7828
Reviewed-on: http://review.whamcloud.com/18499Reviewed-by: NLai Siyao <lai.siyao@intel.com>
Reviewed-by: NAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: NOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: NJames Simmons <jsimmons@infradead.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 817990ba
...@@ -659,8 +659,8 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, ...@@ -659,8 +659,8 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
struct ll_inode_info *lli = ll_i2info(dir); struct ll_inode_info *lli = ll_i2info(dir);
struct ll_statahead_info *sai = lli->lli_sai; struct ll_statahead_info *sai = lli->lli_sai;
struct sa_entry *entry = (struct sa_entry *)minfo->mi_cbdata; struct sa_entry *entry = (struct sa_entry *)minfo->mi_cbdata;
wait_queue_head_t *waitq = NULL;
__u64 handle = 0; __u64 handle = 0;
bool wakeup;
if (it_disposition(it, DISP_LOOKUP_NEG)) if (it_disposition(it, DISP_LOOKUP_NEG))
rc = -ENOENT; rc = -ENOENT;
...@@ -693,7 +693,8 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, ...@@ -693,7 +693,8 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
spin_lock(&lli->lli_sa_lock); spin_lock(&lli->lli_sa_lock);
if (rc) { if (rc) {
wakeup = __sa_make_ready(sai, entry, rc); if (__sa_make_ready(sai, entry, rc))
waitq = &sai->sai_waitq;
} else { } else {
entry->se_minfo = minfo; entry->se_minfo = minfo;
entry->se_req = ptlrpc_request_addref(req); entry->se_req = ptlrpc_request_addref(req);
...@@ -704,13 +705,15 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, ...@@ -704,13 +705,15 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
* with parent's lock held, for example: unlink. * with parent's lock held, for example: unlink.
*/ */
entry->se_handle = handle; entry->se_handle = handle;
wakeup = !sa_has_callback(sai); if (!sa_has_callback(sai))
waitq = &sai->sai_thread.t_ctl_waitq;
list_add_tail(&entry->se_list, &sai->sai_interim_entries); list_add_tail(&entry->se_list, &sai->sai_interim_entries);
} }
sai->sai_replied++; sai->sai_replied++;
if (wakeup) if (waitq)
wake_up(&sai->sai_thread.t_ctl_waitq); wake_up(waitq);
spin_unlock(&lli->lli_sa_lock); spin_unlock(&lli->lli_sa_lock);
return rc; return rc;
...@@ -1397,10 +1400,10 @@ static int revalidate_statahead_dentry(struct inode *dir, ...@@ -1397,10 +1400,10 @@ static int revalidate_statahead_dentry(struct inode *dir,
struct dentry **dentryp, struct dentry **dentryp,
bool unplug) bool unplug)
{ {
struct ll_inode_info *lli = ll_i2info(dir);
struct sa_entry *entry = NULL; struct sa_entry *entry = NULL;
struct l_wait_info lwi = { 0 }; struct l_wait_info lwi = { 0 };
struct ll_dentry_data *ldd; struct ll_dentry_data *ldd;
struct ll_inode_info *lli;
int rc = 0; int rc = 0;
if ((*dentryp)->d_name.name[0] == '.') { if ((*dentryp)->d_name.name[0] == '.') {
...@@ -1446,7 +1449,9 @@ static int revalidate_statahead_dentry(struct inode *dir, ...@@ -1446,7 +1449,9 @@ static int revalidate_statahead_dentry(struct inode *dir,
sa_handle_callback(sai); sa_handle_callback(sai);
if (!sa_ready(entry)) { if (!sa_ready(entry)) {
spin_lock(&lli->lli_sa_lock);
sai->sai_index_wait = entry->se_index; sai->sai_index_wait = entry->se_index;
spin_unlock(&lli->lli_sa_lock);
lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL, lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(30), NULL,
LWI_ON_SIGNAL_NOOP, NULL); LWI_ON_SIGNAL_NOOP, NULL);
rc = l_wait_event(sai->sai_waitq, sa_ready(entry), &lwi); rc = l_wait_event(sai->sai_waitq, sa_ready(entry), &lwi);
...@@ -1514,7 +1519,6 @@ static int revalidate_statahead_dentry(struct inode *dir, ...@@ -1514,7 +1519,6 @@ static int revalidate_statahead_dentry(struct inode *dir,
* dentry_may_statahead(). * dentry_may_statahead().
*/ */
ldd = ll_d2d(*dentryp); ldd = ll_d2d(*dentryp);
lli = ll_i2info(dir);
/* ldd can be NULL if llite lookup failed. */ /* ldd can be NULL if llite lookup failed. */
if (ldd) if (ldd)
ldd->lld_sa_generation = lli->lli_sa_generation; ldd->lld_sa_generation = lli->lli_sa_generation;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册