mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>
Subject: shmctl(SHM_LOCK/UNLOCK) deadlock
Date: Wed, 4 Jun 2003 15:48:28 +0200	[thread overview]
Message-ID: <20030604134828.GZ3412@x30.school.suse.de> (raw)

Hi,

this patch fixes an SMP deadlock that triggered in some production
usage:

--- xxx/mm/shmem.c.~1~	2003-06-01 19:14:07.000000000 +0200
+++ xxx/mm/shmem.c	2003-06-04 02:17:23.000000000 +0200
@@ -808,9 +808,9 @@ void shmem_lock(struct file * file, int 
 	struct inode * inode = file->f_dentry->d_inode;
 	struct shmem_inode_info * info = SHMEM_I(inode);
 
-	down(&info->sem);
+	spin_lock(&info->lock);
 	info->locked = lock;
-	up(&info->sem);
+	spin_unlock(&info->lock);
 }
 
 int shmem_make_bigpage_mmap(struct file * file, struct vm_area_struct * vma)

you can merge it in 21-final IMHO (even dropping the lock enterely would
been ok, the reader is out of order anyways and that's atomic stuff in C
no matter the architecture)

Andrea

                 reply	other threads:[~2003-06-04 13:34 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=20030604134828.GZ3412@x30.school.suse.de \
    --to=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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

all inboxes | Powered by JetHome®