staging: lustre: statahead: ll_intent_drop_lock() called in spinlock
ll_intent_drop_lock() may sleep, which should not be called inside spinlock. Signed-off-by: Lai Siyao <lai.siyao@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2272 Reviewed-on: http://review.whamcloud.com/9665 Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: James Simmons <uja.ornl@gmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e554fbfffc
commit
6535a7d046
@ -661,6 +661,7 @@ 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;
|
||||||
|
__u64 handle = 0;
|
||||||
bool wakeup;
|
bool wakeup;
|
||||||
|
|
||||||
if (it_disposition(it, DISP_LOOKUP_NEG))
|
if (it_disposition(it, DISP_LOOKUP_NEG))
|
||||||
@ -677,6 +678,21 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
|
|||||||
CDEBUG(D_READA, "sa_entry %.*s rc %d\n",
|
CDEBUG(D_READA, "sa_entry %.*s rc %d\n",
|
||||||
entry->se_qstr.len, entry->se_qstr.name, rc);
|
entry->se_qstr.len, entry->se_qstr.name, rc);
|
||||||
|
|
||||||
|
if (rc) {
|
||||||
|
ll_intent_release(it);
|
||||||
|
iput(dir);
|
||||||
|
kfree(minfo);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* release ibits lock ASAP to avoid deadlock when statahead
|
||||||
|
* thread enqueues lock on parent in readdir and another
|
||||||
|
* process enqueues lock on child with parent lock held, eg.
|
||||||
|
* unlink.
|
||||||
|
*/
|
||||||
|
handle = it->it_lock_handle;
|
||||||
|
ll_intent_drop_lock(it);
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock(&lli->lli_sa_lock);
|
spin_lock(&lli->lli_sa_lock);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
wakeup = __sa_make_ready(sai, entry, rc);
|
wakeup = __sa_make_ready(sai, entry, rc);
|
||||||
@ -689,8 +705,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
|
|||||||
* for readpage and other tries to enqueue lock on child
|
* for readpage and other tries to enqueue lock on child
|
||||||
* with parent's lock held, for example: unlink.
|
* with parent's lock held, for example: unlink.
|
||||||
*/
|
*/
|
||||||
entry->se_handle = it->it_lock_handle;
|
entry->se_handle = handle;
|
||||||
ll_intent_drop_lock(it);
|
|
||||||
wakeup = !sa_has_callback(sai);
|
wakeup = !sa_has_callback(sai);
|
||||||
list_add_tail(&entry->se_list, &sai->sai_interim_entries);
|
list_add_tail(&entry->se_list, &sai->sai_interim_entries);
|
||||||
}
|
}
|
||||||
@ -700,11 +715,6 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
|
|||||||
wake_up(&sai->sai_thread.t_ctl_waitq);
|
wake_up(&sai->sai_thread.t_ctl_waitq);
|
||||||
spin_unlock(&lli->lli_sa_lock);
|
spin_unlock(&lli->lli_sa_lock);
|
||||||
|
|
||||||
if (rc) {
|
|
||||||
ll_intent_release(it);
|
|
||||||
iput(dir);
|
|
||||||
kfree(minfo);
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user