public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Sandeen <sandeen@sandeen.net>, Jan Kara <jack@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Fix possible leakage of blocks in UDF
Date: Sun, 3 Jun 2007 11:22:44 +0400	[thread overview]
Message-ID: <20070603072244.GB8396@cvg> (raw)
In-Reply-To: <20070603062840.GA8396@cvg>

[Cyrill Gorcunov - Sun, Jun 03, 2007 at 10:28:40AM +0400]
| [Andrew Morton - Sat, Jun 02, 2007 at 03:49:42PM -0700]
| | On Sun, 3 Jun 2007 00:01:46 +0400 Cyrill Gorcunov <gorcunov@gmail.com> wrote:
| | 
| | > [Andrew Morton - Sat, Jun 02, 2007 at 12:16:16PM -0700]
| | > [...snip...]
| | > | 
| | > | No, the problem is that the patch caused the kernel to take inode_lock
| | > | within the newly-added drop_inode(), btu drop_inode() is already called
| | > | under inode_lock.
| | > | 
| | > | It has nothing to do with lock_kernel() and it has nothing to do with
| | > | sleeping.
| | > | 
| | > 
| | > Andrew, the only call that could leading to subseq. inode_lock lock
| | > is mark_inode_dirty() I guess (and that is snown by Eric's dump)
| | > but as I shown you in my dbg print without SMP it's OK. So
| | > is it SMP who lead to lock? How it depends on it? (I understand
| | > that is a stupid question for you but if you have time explain
| | > me this please ;)
| | > 
| | 
| | When CONFIG_SMP=n, spin_lock() is a no-op.  (Except with CONFIG_PREEMPT=y,
| | in which case spin_lock() will disable kernel preemption on SMP and non-SMP
| | kernels)
| | 
| | When CONFIG_SMP=y, spin_lock() really does take a lock.  But if this thread
| | already holds this lock, we'll deadlock.
| | 
| 
| Thanks, Andrew. So the reason that raises lock problem is the calling of
| mark_inode_dirty() inside drop_inode() (by indirection). And I see two way
| of solution:
| 
| - or check for inode->i_count at each mark_inode_dirty that being called
|   after drop_inode
| 
| 		if (inode->i_count > 0)
| 				mark_inode_dirty()
| 
| - or wrap mark_inode_dirty as
| 
| 	udf_mark_inode_dirty()
| 	{
- 		if (inode->i_count > 0)
+		if (atomic_read(&inode->i_count) > 0)
| 			mark_inode_dirty();
| 	}
| 
| 	and replace all mark_inode_dirty -> udf_mark_inode_dirty
| 
| Your thoughts?
| 
| 		Cyrill
| 


		Cyrill


  reply	other threads:[~2007-06-03  7:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-24 16:59 [PATCH 1/2] Fix possible UDF data corruption Jan Kara
2007-05-24 17:05 ` [PATCH 2/2] Fix possible leakage of blocks in UDF Jan Kara
2007-05-24 20:36   ` Jan Kara
2007-05-30 21:46     ` Eric Sandeen
2007-05-30 22:22       ` Eric Sandeen
2007-05-31 16:48         ` Cyrill Gorcunov
2007-05-31 17:42         ` Cyrill Gorcunov
2007-05-31 17:46           ` Eric Sandeen
2007-06-01 16:49             ` Cyrill Gorcunov
2007-06-01 17:04               ` Andrew Morton
2007-06-01 17:15                 ` Cyrill Gorcunov
2007-06-01 17:17                 ` Eric Sandeen
2007-06-01 17:48                   ` Cyrill Gorcunov
2007-06-01 17:51                     ` Eric Sandeen
2007-06-01 17:52                       ` Cyrill Gorcunov
2007-06-01 18:20                       ` Cyrill Gorcunov
2007-06-01 21:10       ` Jan Kara
2007-06-01 21:05         ` Eric Sandeen
2007-06-01 22:37         ` Eric Sandeen
2007-06-01 22:48           ` Andrew Morton
2007-06-02  5:17             ` Eric Sandeen
2007-06-02  5:43               ` Andrew Morton
2007-06-02  6:34                 ` Cyrill Gorcunov
2007-06-02  6:54                   ` Andrew Morton
2007-06-02  6:59                     ` Cyrill Gorcunov
2007-06-02  7:06                       ` Andrew Morton
2007-06-02 14:06                         ` Cyrill Gorcunov
2007-06-02 17:32                           ` Andrew Morton
2007-06-02 18:57                             ` Cyrill Gorcunov
2007-06-02 19:16                               ` Andrew Morton
2007-06-02 20:01                                 ` Cyrill Gorcunov
2007-06-02 22:49                                   ` Andrew Morton
2007-06-03  6:28                                     ` Cyrill Gorcunov
2007-06-03  7:22                                       ` Cyrill Gorcunov [this message]
2007-06-04 15:53         ` Cyrill Gorcunov
2007-05-24 17:20 ` [PATCH 1/2] Fix possible UDF data corruption Cyrill Gorcunov
2007-05-24 18:35   ` Andrew Morton
2007-05-24 18:53     ` Cyrill Gorcunov
2007-05-24 19:23     ` Cyrill Gorcunov
2007-05-24 19:36       ` Andrew Morton
2007-05-24 19:49         ` Cyrill Gorcunov

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=20070603072244.GB8396@cvg \
    --to=gorcunov@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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