All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jianpeng Ma <majianpeng@gmail.com>,
	Sage Weil <sage@inktank.com>
Subject: [ 02/19] ceph: fix sleeping function called from invalid context.
Date: Thu, 11 Jul 2013 15:01:19 -0700	[thread overview]
Message-ID: <20130711214830.924767898@linuxfoundation.org> (raw)
In-Reply-To: <20130711214830.611455274@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: majianpeng <majianpeng@gmail.com>

commit a1dc1937337a93e699eaa56968b7de6e1a9e77cf upstream.

[ 1121.231883] BUG: sleeping function called from invalid context at kernel/rwsem.c:20
[ 1121.231935] in_atomic(): 1, irqs_disabled(): 0, pid: 9831, name: mv
[ 1121.231971] 1 lock held by mv/9831:
[ 1121.231973]  #0:  (&(&ci->i_ceph_lock)->rlock){+.+...},at:[<ffffffffa02bbd38>] ceph_getxattr+0x58/0x1d0 [ceph]
[ 1121.231998] CPU: 3 PID: 9831 Comm: mv Not tainted 3.10.0-rc6+ #215
[ 1121.232000] Hardware name: To Be Filled By O.E.M. To Be Filled By
O.E.M./To be filled by O.E.M., BIOS 080015  11/09/2011
[ 1121.232027]  ffff88006d355a80 ffff880092f69ce0 ffffffff8168348c ffff880092f69cf8
[ 1121.232045]  ffffffff81070435 ffff88006d355a20 ffff880092f69d20 ffffffff816899ba
[ 1121.232052]  0000000300000004 ffff8800b76911d0 ffff88006d355a20 ffff880092f69d68
[ 1121.232056] Call Trace:
[ 1121.232062]  [<ffffffff8168348c>] dump_stack+0x19/0x1b
[ 1121.232067]  [<ffffffff81070435>] __might_sleep+0xe5/0x110
[ 1121.232071]  [<ffffffff816899ba>] down_read+0x2a/0x98
[ 1121.232080]  [<ffffffffa02baf70>] ceph_vxattrcb_layout+0x60/0xf0 [ceph]
[ 1121.232088]  [<ffffffffa02bbd7f>] ceph_getxattr+0x9f/0x1d0 [ceph]
[ 1121.232093]  [<ffffffff81188d28>] vfs_getxattr+0xa8/0xd0
[ 1121.232097]  [<ffffffff8118900b>] getxattr+0xab/0x1c0
[ 1121.232100]  [<ffffffff811704f2>] ? final_putname+0x22/0x50
[ 1121.232104]  [<ffffffff81155f80>] ? kmem_cache_free+0xb0/0x260
[ 1121.232107]  [<ffffffff811704f2>] ? final_putname+0x22/0x50
[ 1121.232110]  [<ffffffff8109e63d>] ? trace_hardirqs_on+0xd/0x10
[ 1121.232114]  [<ffffffff816957a7>] ? sysret_check+0x1b/0x56
[ 1121.232120]  [<ffffffff81189c9c>] SyS_fgetxattr+0x6c/0xc0
[ 1121.232125]  [<ffffffff81695782>] system_call_fastpath+0x16/0x1b
[ 1121.232129] BUG: scheduling while atomic: mv/9831/0x10000002
[ 1121.232154] 1 lock held by mv/9831:
[ 1121.232156]  #0:  (&(&ci->i_ceph_lock)->rlock){+.+...}, at:
[<ffffffffa02bbd38>] ceph_getxattr+0x58/0x1d0 [ceph]

I think move the ci->i_ceph_lock down is safe because we can't free
ceph_inode_info at there.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/xattr.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -675,17 +675,18 @@ ssize_t ceph_getxattr(struct dentry *den
 	if (!ceph_is_valid_xattr(name))
 		return -ENODATA;
 
-	spin_lock(&ci->i_ceph_lock);
-	dout("getxattr %p ver=%lld index_ver=%lld\n", inode,
-	     ci->i_xattrs.version, ci->i_xattrs.index_version);
 
 	/* let's see if a virtual xattr was requested */
 	vxattr = ceph_match_vxattr(inode, name);
 	if (vxattr && !(vxattr->exists_cb && !vxattr->exists_cb(ci))) {
 		err = vxattr->getxattr_cb(ci, value, size);
-		goto out;
+		return err;
 	}
 
+	spin_lock(&ci->i_ceph_lock);
+	dout("getxattr %p ver=%lld index_ver=%lld\n", inode,
+	     ci->i_xattrs.version, ci->i_xattrs.index_version);
+
 	if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 1) &&
 	    (ci->i_xattrs.index_version >= ci->i_xattrs.version)) {
 		goto get_xattr;



  parent reply	other threads:[~2013-07-11 22:06 UTC|newest]

Thread overview: 136+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11 22:01 [ 00/19] 3.10.1-stable review Greg Kroah-Hartman
2013-07-11 22:01 ` [ 01/19] libceph: Fix NULL pointer dereference in auth client code Greg Kroah-Hartman
2013-07-11 22:01 ` Greg Kroah-Hartman [this message]
2013-07-11 22:01 ` [ 03/19] libceph: fix invalid unsigned->signed conversion for timespec encoding Greg Kroah-Hartman
2013-07-11 22:01 ` [ 04/19] drivers/cdrom/cdrom.c: use kzalloc() for failing hardware Greg Kroah-Hartman
2013-07-11 22:01 ` [ 05/19] module: do percpu allocation after uniqueness check. No, really! Greg Kroah-Hartman
2013-07-11 22:01 ` [ 06/19] charger-manager: Ensure event is not used as format string Greg Kroah-Hartman
2013-07-11 22:01 ` [ 07/19] hpfs: better test for errors Greg Kroah-Hartman
2013-07-11 22:01 ` [ 08/19] block: do not pass disk names as format strings Greg Kroah-Hartman
2013-07-11 22:01 ` [ 09/19] crypto: sanitize argument for format string Greg Kroah-Hartman
2013-07-11 22:01   ` Greg Kroah-Hartman
2013-07-11 22:01 ` [ 10/19] MAINTAINERS: add stable_kernel_rules.txt to stable maintainer information Greg Kroah-Hartman
2013-07-11 22:01 ` [ 11/19] futex: Take hugepages into account when generating futex_key Greg Kroah-Hartman
2013-07-11 22:01 ` [ 12/19] tty: Reset itty for other pty Greg Kroah-Hartman
2013-07-11 22:01 ` [ 13/19] Revert "serial: 8250_pci: add support for another kind of NetMos Technology PCI 9835 Multi-I/O Controller" Greg Kroah-Hartman
2013-07-11 22:01 ` [ 14/19] NFSv4.1 end back channel session draining Greg Kroah-Hartman
2013-07-11 22:01 ` [ 15/19] nfsd4: fix decoding of compounds across page boundaries Greg Kroah-Hartman
2013-07-11 22:01 ` [ 16/19] KVM: VMX: mark unusable segment as nonpresent Greg Kroah-Hartman
2013-07-11 22:01 ` [ 17/19] SCSI: sd: Fix parsing of temporary cache mode prefix Greg Kroah-Hartman
2013-07-11 22:01 ` [ 18/19] cpufreq: Fix cpufreq regression after suspend/resume Greg Kroah-Hartman
2013-07-11 22:01 ` [ 19/19] Revert "memcg: avoid dangling reference count in creation failure" Greg Kroah-Hartman
2013-07-11 22:14 ` [ 00/19] 3.10.1-stable review Josh Boyer
2013-07-14 22:54   ` Benjamin Herrenschmidt
2013-07-11 22:29 ` Dave Jones
2013-07-11 22:44   ` Greg Kroah-Hartman
2013-07-12  1:51     ` Steven Rostedt
2013-07-12 14:15     ` Guenter Roeck
2013-07-12 15:22       ` Linus Torvalds
2013-07-12 15:47         ` Steven Rostedt
2013-07-12 15:55           ` Linus Torvalds
2013-07-12 16:17             ` Ingo Molnar
2013-07-12 16:35               ` Josh Boyer
2013-07-12 16:36                 ` Josh Boyer
2013-07-12 17:05                 ` Greg Kroah-Hartman
2013-07-14 22:40                   ` Benjamin Herrenschmidt
2013-07-12 16:48             ` Steven Rostedt
2013-07-12 17:31         ` Guenter Roeck
2013-07-12 17:50           ` Linus Torvalds
2013-07-12 18:11             ` Guenter Roeck
2013-07-12 19:35               ` Theodore Ts'o
2013-07-12 19:49                 ` Steven Rostedt
2013-07-12 19:55                   ` Willy Tarreau
2013-07-12 20:19                   ` Dave Jones
2013-07-12 20:28                     ` Steven Rostedt
2013-07-12 20:31                       ` Steven Rostedt
2013-07-12 21:19                       ` Justin M. Forbes
2013-07-13  0:47                       ` Jochen Striepe
2013-07-13 11:11                         ` Steven Rostedt
2013-07-13 15:10                           ` Dave Jones
2013-07-13 15:54                             ` Steven Rostedt
2013-07-12 19:50             ` Willy Tarreau
2013-07-12 20:47               ` Theodore Ts'o
2013-07-12 21:02                 ` Guenter Roeck
2013-07-13  6:22               ` Greg Kroah-Hartman
2013-07-13  6:36                 ` Willy Tarreau
2013-07-13  6:48                   ` Greg Kroah-Hartman
2013-07-13  7:12                     ` Willy Tarreau
2013-07-15  4:12                       ` Li Zefan
2013-07-15  4:43                         ` Willy Tarreau
2013-07-13 11:42                     ` Theodore Ts'o
2013-07-13 18:27                       ` Greg Kroah-Hartman
2013-07-14  2:22                         ` Theodore Ts'o
2013-07-14  3:51                           ` Greg Kroah-Hartman
2013-07-14  5:24                             ` Guenter Roeck
2013-07-14 20:31                               ` Geert Uytterhoeven
2013-07-13  6:43                 ` Guenter Roeck
2013-07-13  6:58                   ` Greg Kroah-Hartman
2013-07-14 23:52             ` Benjamin Herrenschmidt
2013-07-15  1:40               ` Linus Torvalds
2013-07-15  2:08                 ` Benjamin Herrenschmidt
2013-07-14 22:58     ` Benjamin Herrenschmidt
2013-07-12  0:50 ` When to push bug fixes to mainline Theodore Ts'o
2013-07-12  1:20   ` [Ksummit-2013-discuss] " Nicholas A. Bellinger
2013-07-12  1:54   ` Steven Rostedt
2013-07-12  9:46     ` Jiri Kosina
2013-07-12 11:19       ` Josh Boyer
2013-07-12  2:57   ` John W. Linville
2013-07-12  3:34     ` Greg Kroah-Hartman
2013-07-12  7:32       ` James Bottomley
2013-07-12 17:20       ` H. Peter Anvin
2013-07-12 17:28         ` Greg Kroah-Hartman
2013-07-12 17:50           ` Steven Rostedt
2013-07-12 17:59             ` Linus Torvalds
2013-07-12 18:14               ` Steven Rostedt
2013-07-13 17:52                 ` Geert Uytterhoeven
2013-07-12 17:57           ` Theodore Ts'o
2013-07-12 18:13             ` Guenter Roeck
2013-07-12 18:16             ` H. Peter Anvin
2013-07-12 18:28               ` H. Peter Anvin
2013-07-12 19:44                 ` Linus Torvalds
2013-07-12 19:53                   ` Steven Rostedt
2013-07-12 20:09                     ` Shuah Khan
2013-07-12 20:33                     ` Greg Kroah-Hartman
2013-07-12 20:46                       ` Steven Rostedt
2013-07-12 22:19                       ` H. Peter Anvin
2013-07-12 22:17                     ` H. Peter Anvin
2013-07-13  6:44                   ` Ingo Molnar
2013-07-13  0:24       ` Rafael J. Wysocki
2013-07-13  1:32         ` Greg Kroah-Hartman
2013-07-13 12:16           ` Rafael J. Wysocki
2013-07-12  3:25   ` Li Zefan
2013-07-15  4:22     ` Rob Landley
2013-07-12  5:14   ` Willy Tarreau
2013-07-16  7:19     ` David Lang
2013-07-16 16:40       ` [Ksummit-2013-discuss] " Takashi Iwai
2013-07-16 16:42         ` David Lang
2013-07-16 19:29           ` Takashi Iwai
2013-07-16 16:59         ` Mark Brown
2013-07-16 17:58           ` Luck, Tony
2013-07-16 17:58             ` Luck, Tony
2013-07-16 18:29             ` Linus Torvalds
2013-07-16 18:29               ` Linus Torvalds
2013-07-16 18:41               ` Steven Rostedt
2013-07-16 18:41                 ` Steven Rostedt
2013-07-16 19:11                 ` Greg Kroah-Hartman
2013-07-16 19:11                   ` Greg Kroah-Hartman
2013-07-16 19:43                   ` Steven Rostedt
2013-07-16 19:43                     ` Steven Rostedt
2013-07-16 20:10                     ` Willy Tarreau
2013-07-16 20:10                       ` Willy Tarreau
2013-07-17  2:58                       ` Ben Hutchings
2013-07-17  2:58                         ` Ben Hutchings
2013-07-17  9:43                       ` Li Zefan
2013-07-17  9:43                         ` Li Zefan
2013-07-16 18:48               ` Willy Tarreau
2013-07-16 18:48                 ` Willy Tarreau
2013-07-19 10:13               ` Ingo Molnar
2013-07-19 10:13                 ` Ingo Molnar
2013-07-16 18:39         ` Willy Tarreau
2013-07-16 18:40       ` H. Peter Anvin
2013-07-16 20:29         ` David Lang
2013-07-12 17:11   ` H. Peter Anvin
2013-07-12 17:20 ` [ 00/19] 3.10.1-stable review Shuah Khan
2013-07-12 17:29   ` Greg Kroah-Hartman
2013-07-13  4:14 ` Satoru Takeuchi
2013-07-14 23:06 ` Benjamin Herrenschmidt

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=20130711214830.924767898@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=majianpeng@gmail.com \
    --cc=sage@inktank.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.