linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org, suparna@in.ibm.com, linux-aio@kvack.org
Subject: [2/2] correct use_mm()/unuse_mm() to use task_lock() to protect ->mm
Date: Mon, 31 May 2004 22:54:59 -0700	[thread overview]
Message-ID: <20040601055459.GG2093@holomorphy.com> (raw)
In-Reply-To: <20040601055118.GF2093@holomorphy.com>

Split off from suparna's patches:

Correct use_mm()/unuse_mm() to use task_lock() to protect task->mm.

Index: suparna-2.6.7-rc2/fs/aio.c
===================================================================
--- suparna-2.6.7-rc2.orig/fs/aio.c	2004-05-31 22:06:35.788770000 -0700
+++ suparna-2.6.7-rc2/fs/aio.c	2004-05-31 22:08:41.057727000 -0700
@@ -538,19 +538,25 @@
 
 static void use_mm(struct mm_struct *mm)
 {
-	struct mm_struct *active_mm = current->active_mm;
+	struct mm_struct *active_mm;
+
 	atomic_inc(&mm->mm_count);
+	task_lock(current);
+	active_mm = current->active_mm;
 	current->mm = mm;
 	if (mm != active_mm) {
 		current->active_mm = mm;
 		activate_mm(active_mm, mm);
 	}
+	task_unlock(current);
 	mmdrop(active_mm);
 }
 
 static void unuse_mm(struct mm_struct *mm)
 {
+	task_lock(current);
 	current->mm = NULL;
+	task_unlock(current);
 	/* active_mm is still 'mm' */
 	enter_lazy_tlb(mm, current);
 }

      reply	other threads:[~2004-06-01  5:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-01  5:51 [1/2] use aio workqueue in fs/aio.c William Lee Irwin III
2004-06-01  5:54 ` William Lee Irwin III [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040601055459.GG2093@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suparna@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).