public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable <stable@vger.kernel.org>
Cc: Jiri Kosina <jkosina@suse.cz>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [stable-3.0 revert request] sysfs: fix race between readdir and lseek
Date: Mon, 22 Apr 2013 15:35:42 +0200	[thread overview]
Message-ID: <51753CAE.5010506@suse.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.1304221530120.1341@pobox.suse.cz>

Thanks to Jiri Kosina et al...

See the reasons below.

On 04/22/2013 03:32 PM, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@suse.cz>
> Subject: [PATCH 3.0-stable] Revert "sysfs: fix race between readdir and lseek"
> 
> This reverts commit 991f76f837bf22c5bb07261cfd86525a0a96650c.
> 
> It depends on ef3d0fd27e90f ("vfs: do (nearly) lockless generic_file_llseek")
> which is available only in 3.2+.
> 
> When applied on 3.0 codebase, it causes A-A deadlock, whenever anyone does
> seek() on sysfs, as both generic_file_llseek() and sysfs_dir_llseek() obtain
> i_mutex.
> 
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
>  fs/sysfs/dir.c |   13 +------------
>  1 files changed, 1 insertions(+), 12 deletions(-)
> 
> Index: linux-3.0-SLE11-SP3-sysfs-hang-debug/fs/sysfs/dir.c
> ===================================================================
> --- linux-3.0-SLE11-SP3-sysfs-hang-debug.orig/fs/sysfs/dir.c
> +++ linux-3.0-SLE11-SP3-sysfs-hang-debug/fs/sysfs/dir.c
> @@ -961,21 +961,9 @@ static int sysfs_readdir(struct file * f
>  	return 0;
>  }
>  
> -static loff_t sysfs_dir_llseek(struct file *file, loff_t offset, int whence)
> -{
> -	struct inode *inode = file->f_path.dentry->d_inode;
> -	loff_t ret;
> -
> -	mutex_lock(&inode->i_mutex);
> -	ret = generic_file_llseek(file, offset, whence);
> -	mutex_unlock(&inode->i_mutex);
> -
> -	return ret;
> -}
> -
>  const struct file_operations sysfs_dir_operations = {
>  	.read		= generic_read_dir,
>  	.readdir	= sysfs_readdir,
>  	.release	= sysfs_dir_release,
> -	.llseek		= sysfs_dir_llseek,
> +	.llseek		= generic_file_llseek,
>  };
> 


-- 
js
suse labs

           reply	other threads:[~2013-04-22 13:35 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <alpine.LNX.2.00.1304221530120.1341@pobox.suse.cz>]

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=51753CAE.5010506@suse.cz \
    --to=jslaby@suse.cz \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.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