From: Dave McCracken <dmccr@us.ibm.com>
To: Andrew Morton <akpm@digeo.com>
Cc: Linux Memory Management <linux-mm@kvack.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.5.73-mm1] Make sure truncate fix has no race
Date: Fri, 27 Jun 2003 11:13:19 -0500 [thread overview]
Message-ID: <69440000.1056730399@baldur.austin.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
Paul McKenney pointed out that reading the truncate sequence number in
do_no_page might not be entirely safe if the ->nopage callout takes no
locks. The simple solution is to move the read before the unlock of
page_table_lock. Here's a patch that does it.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
dmccr@us.ibm.com T/L 678-3059
[-- Attachment #2: trunc-2.5.73-mm1-1.diff --]
[-- Type: text/plain, Size: 897 bytes --]
--- 2.5.73-mm1/mm/memory.c 2003-06-27 10:40:48.000000000 -0500
+++ 2.5.73-mm1-trunc/mm/memory.c 2003-06-27 10:47:10.000000000 -0500
@@ -1402,11 +1402,11 @@ do_no_page(struct mm_struct *mm, struct
return do_anonymous_page(mm, vma, page_table,
pmd, write_access, address);
pte_unmap(page_table);
- spin_unlock(&mm->page_table_lock);
mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
-retry:
sequence = atomic_read(&mapping->truncate_count);
+ spin_unlock(&mm->page_table_lock);
+retry:
new_page = vma->vm_ops->nopage(vma, address & PAGE_MASK, 0);
/* no page was available -- either SIGBUS or OOM */
@@ -1441,6 +1441,7 @@ retry:
* retry getting the page.
*/
if (unlikely(sequence != atomic_read(&mapping->truncate_count))) {
+ sequence = atomic_read(&mapping->truncate_count);
spin_unlock(&mm->page_table_lock);
page_cache_release(new_page);
goto retry;
reply other threads:[~2003-06-27 16:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=69440000.1056730399@baldur.austin.ibm.com \
--to=dmccr@us.ibm.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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