diff mbox

ocfs2: add missing lockres put in dlm_mig_lockres_handler

Message ID 51AEFC8E.3080507@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Xue jiufei June 5, 2013, 8:53 a.m. UTC
dlm_mig_lockres_handler goes to leave, when lockres with state
DLM_LOCK_RES_RECOVERING, not putting lockres taken in dlm_lookup_lockres.

Signed-off-by: joyce <xuejiufei@huawei.com>
---
 fs/ocfs2/dlm/dlmrecovery.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Shen Canquan June 5, 2013, 11:11 a.m. UTC | #1
On 2013/6/5 16:53, Xue jiufei wrote:
> dlm_mig_lockres_handler goes to leave, when lockres with state
> DLM_LOCK_RES_RECOVERING, not putting lockres taken in dlm_lookup_lockres.
   it is obvious bug. it cause memory leak.
   Reviewed-by: shencanquan <shencanquan@huawei.com>
> Signed-off-by: joyce<xuejiufei@huawei.com>
> ---
>   fs/ocfs2/dlm/dlmrecovery.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index a145cf8..241ced4 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -1408,6 +1408,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
>   				     mres->lockname_len, mres->lockname);
>   				ret = -EFAULT;
>   				spin_unlock(&res->spinlock);
> +				dlm_lockres_put(res);
>   				goto leave;
>   			}
>   			res->state |= DLM_LOCK_RES_MIGRATING;
Joel Becker June 7, 2013, 10:32 p.m. UTC | #2
On Wed, Jun 05, 2013 at 04:53:34PM +0800, Xue jiufei wrote:
> dlm_mig_lockres_handler goes to leave, when lockres with state
> DLM_LOCK_RES_RECOVERING, not putting lockres taken in dlm_lookup_lockres.
> 
> Signed-off-by: joyce <xuejiufei@huawei.com>

Acked-by: Joel Becker <jlbec@evilplan.org>

> ---
>  fs/ocfs2/dlm/dlmrecovery.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
> index a145cf8..241ced4 100644
> --- a/fs/ocfs2/dlm/dlmrecovery.c
> +++ b/fs/ocfs2/dlm/dlmrecovery.c
> @@ -1408,6 +1408,7 @@ int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
>  				     mres->lockname_len, mres->lockname);
>  				ret = -EFAULT;
>  				spin_unlock(&res->spinlock);
> +				dlm_lockres_put(res);
>  				goto leave;
>  			}
>  			res->state |= DLM_LOCK_RES_MIGRATING;
> -- 
> 1.7.9.7
> 
> 
> _______________________________________________
> Ocfs2-devel mailing list
> Ocfs2-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/ocfs2-devel
diff mbox

Patch

diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index a145cf8..241ced4 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1408,6 +1408,7 @@  int dlm_mig_lockres_handler(struct o2net_msg *msg, u32 len, void *data,
 				     mres->lockname_len, mres->lockname);
 				ret = -EFAULT;
 				spin_unlock(&res->spinlock);
+				dlm_lockres_put(res);
 				goto leave;
 			}
 			res->state |= DLM_LOCK_RES_MIGRATING;