From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Pavel Machek <pavel@ucw.cz>,
trivial@kernel.org, mark@fasheh.com, jlbec@evilplan.org,
ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Junxiao Bi <junxiao.bi@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] ocfs2: fix unbalanced locking
Date: Mon, 27 Jul 2020 15:15:04 +0800 [thread overview]
Message-ID: <41de02bf-3c16-3492-6f9c-7ae4b519778e@linux.alibaba.com> (raw)
In-Reply-To: <20200724124443.GA28164@duo.ucw.cz>
On 2020/7/24 20:44, Pavel Machek wrote:
>
> Based on what fails, function can return with nfs_sync_rwlock either
> locked or unlocked. That can not be right.
>
> Always return with lock unlocked on error.
>
> Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
Looks good.
Fixes: 4cd9973f9ff6 ("ocfs2: avoid inode removal while nfsd is accessing it")
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
>
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index 751bc4dc7466..8e3a369086db 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -2871,9 +2871,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex)
>
> status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE,
> 0, 0);
> - if (status < 0)
> + if (status < 0) {
> mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status);
>
> + if (ex)
> + up_write(&osb->nfs_sync_rwlock);
> + else
> + up_read(&osb->nfs_sync_rwlock);
> + }
> +
> return status;
> }
>
>
prev parent reply other threads:[~2020-07-27 7:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 12:44 Pavel Machek
2020-07-27 7:15 ` Joseph Qi [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=41de02bf-3c16-3492-6f9c-7ae4b519778e@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=jlbec@evilplan.org \
--cc=junxiao.bi@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=pavel@ucw.cz \
--cc=torvalds@linux-foundation.org \
--cc=trivial@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
all inboxes | Powered by JetHome®