Linux ocfs2 filesystem development
 help / color / mirror / Atom feed
From: alex chen <alex.chen@huawei.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: fix deadlock due to wrong locking order
Date: Thu, 25 Sep 2014 20:38:02 +0800	[thread overview]
Message-ID: <54240CAA.6090301@huawei.com> (raw)
In-Reply-To: <5423B893.30504@oracle.com>


On 2014/9/25 14:39, Junxiao Bi wrote:
> Yes, this should be fixed. How about the following fix?
> 
> diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
> index c534cb0..682732f 100644
> --- a/fs/ocfs2/file.c
> +++ b/fs/ocfs2/file.c
> @@ -833,14 +833,17 @@ static int ocfs2_write_zero_page(struct inode
> *inode, u64 abs_from,
>         di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
>         di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
>         di->i_mtime_nsec = di->i_ctime_nsec;
> -       ocfs2_journal_dirty(handle, di_bh);
> -       ocfs2_update_inode_fsync_trans(handle, inode, 1);
> +       if (handle) {
> +               ocfs2_journal_dirty(handle, di_bh);
> +               ocfs2_update_inode_fsync_trans(handle, inode, 1);
> +       }
> 
>  out_unlock:
>         unlock_page(page);
>         page_cache_release(page);
>  out_commit_trans:
> -       ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
> +       if (handle)
> +               ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
>  out:
>         return ret;
>  }
> 
> 
> Thanks,
> Junxiao.

OK, thanks.
	--Alex

      reply	other threads:[~2014-09-25 12:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  1:48 [Ocfs2-devel] [PATCH] ocfs2: fix deadlock due to wrong locking order Junxiao Bi
2014-09-24  8:49 ` alex chen
2014-09-25  6:41   ` Junxiao Bi
2014-09-24  9:41 ` alex chen
2014-09-25  6:39   ` Junxiao Bi
2014-09-25 12:38     ` alex chen [this message]

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=54240CAA.6090301@huawei.com \
    --to=alex.chen@huawei.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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