@@ -1512,6 +1512,9 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry)
task = kthread_create(ll_statahead_thread, parent, "ll_sa_%u",
lli->lli_opendir_pid);
if (IS_ERR(task)) {
+ spin_lock(&lli->lli_sa_lock);
+ lli->lli_sai = NULL;
+ spin_unlock(&lli->lli_sa_lock);
rc = PTR_ERR(task);
CERROR("can't start ll_sa thread, rc : %d\n", rc);
goto out;
@@ -1537,8 +1540,8 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry)
* that subsequent stat won't waste time to try it.
*/
spin_lock(&lli->lli_sa_lock);
- lli->lli_sa_enabled = 0;
- lli->lli_sai = NULL;
+ if (lli->lli_opendir_pid == current->pid)
+ lli->lli_sa_enabled = 0;
spin_unlock(&lli->lli_sa_lock);
if (sai)
ll_sai_free(sai);