linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: btrfs: enhance transaction abort infrastructure
@ 2012-04-02  9:08 Dan Carpenter
  2012-04-02 10:46 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-04-02  9:08 UTC (permalink / raw)
  To: jeffm; +Cc: linux-btrfs

Hi Jeff,

The patch 49b25e054090: "btrfs: enhance transaction abort 
infrastructure" from Mar 1, 2012, leads to the following warning:
fs/btrfs/transaction.c:137 join_transaction()
	warn: inconsistent returns spin_lock:&root->fs_info->trans_lock:
	locked (77) unlocked  (64,70,82,88,137)

fs/btrfs/transaction.c
    74          cur_trans = root->fs_info->running_transaction;
    75          if (cur_trans) {
    76                  if (cur_trans->aborted)
    77                          return cur_trans->aborted;
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
Should we do a spin_unlock(&root->fs_info->trans_lock); here before
returning?

    78                  atomic_inc(&cur_trans->use_count);
    79                  atomic_inc(&cur_trans->num_writers);
    80                  cur_trans->num_joined++;
    81                  spin_unlock(&root->fs_info->trans_lock);
    82                  return 0;
    83          }
    84          spin_unlock(&root->fs_info->trans_lock);

Also later on:

  1399          ret = commit_fs_roots(trans, root);
  1400          if (ret) {
  1401                  mutex_unlock(&root->fs_info->tree_log_mutex);
  1402                  goto cleanup_transaction;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^
  1403          }
  1404  
  1405          /* commit_fs_roots gets rid of all the tree log roots, it is now
  1406           * safe to free the root of tree log roots
  1407           */
  1408          btrfs_free_log_root_tree(trans, root->fs_info);
  1409  
  1410          ret = commit_cowonly_roots(trans, root);
  1411          if (ret) {
  1412                  mutex_unlock(&root->fs_info->tree_log_mutex);
  1413                  goto cleanup_transaction;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^

Should we do an mutex_unlock(&root->fs_info->reloc_mutex); before these
two gotos?

  1414          }

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: btrfs: enhance transaction abort infrastructure
  2012-04-02  9:08 btrfs: enhance transaction abort infrastructure Dan Carpenter
@ 2012-04-02 10:46 ` David Sterba
  2012-04-02 12:48   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2012-04-02 10:46 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: jeffm, linux-btrfs

Hi,

On Mon, Apr 02, 2012 at 12:08:54PM +0300, Dan Carpenter wrote:
> The patch 49b25e054090: "btrfs: enhance transaction abort 
> infrastructure" from Mar 1, 2012, leads to the following warning:
> fs/btrfs/transaction.c:137 join_transaction()
> 	warn: inconsistent returns spin_lock:&root->fs_info->trans_lock:
> 	locked (77) unlocked  (64,70,82,88,137)
> 
> fs/btrfs/transaction.c
>     74          cur_trans = root->fs_info->running_transaction;
>     75          if (cur_trans) {
>     76                  if (cur_trans->aborted)
>     77                          return cur_trans->aborted;
>                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
> Should we do a spin_unlock(&root->fs_info->trans_lock); here before
> returning?

Yes.

> 
>     78                  atomic_inc(&cur_trans->use_count);
>     79                  atomic_inc(&cur_trans->num_writers);
>     80                  cur_trans->num_joined++;
>     81                  spin_unlock(&root->fs_info->trans_lock);
>     82                  return 0;
>     83          }
>     84          spin_unlock(&root->fs_info->trans_lock);
> 
> Also later on:
> 
>   1399          ret = commit_fs_roots(trans, root);
>   1400          if (ret) {
>   1401                  mutex_unlock(&root->fs_info->tree_log_mutex);
>   1402                  goto cleanup_transaction;
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^
>   1403          }
>   1404  
>   1405          /* commit_fs_roots gets rid of all the tree log roots, it is now
>   1406           * safe to free the root of tree log roots
>   1407           */
>   1408          btrfs_free_log_root_tree(trans, root->fs_info);
>   1409  
>   1410          ret = commit_cowonly_roots(trans, root);
>   1411          if (ret) {
>   1412                  mutex_unlock(&root->fs_info->tree_log_mutex);
>   1413                  goto cleanup_transaction;
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Should we do an mutex_unlock(&root->fs_info->reloc_mutex); before these
> two gotos?

Yes.

Thanks for cathing it.  Are you going to send a patch or are you fine
with a Reported-by: ?


david

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: btrfs: enhance transaction abort infrastructure
  2012-04-02 10:46 ` David Sterba
@ 2012-04-02 12:48   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-04-02 12:48 UTC (permalink / raw)
  To: jeffm, linux-btrfs, David Sterba

On Mon, Apr 02, 2012 at 12:46:44PM +0200, David Sterba wrote:
> 
> Thanks for cathing it.  Are you going to send a patch or are you fine
> with a Reported-by: ?
> 

You're welcome.  :)  Reported-by is fine.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-02 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02  9:08 btrfs: enhance transaction abort infrastructure Dan Carpenter
2012-04-02 10:46 ` David Sterba
2012-04-02 12:48   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).