public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kinglong Mee <kinglongmee@gmail.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v2] nfsd: Fix memory leak of so_owner.data in nfs4_stateowner
Date: Fri, 17 Jul 2015 11:59:45 -0400	[thread overview]
Message-ID: <20150717155945.GD6263@fieldses.org> (raw)
In-Reply-To: <55A72D73.4040609@gmail.com>

On Thu, Jul 16, 2015 at 12:05:07PM +0800, Kinglong Mee wrote:
> v2, new helper nfs4_free_stateowner for freeing so_owner.data and sop

Got it, thanks.--b.

> 
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
>  fs/nfsd/nfs4state.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 00a0f8f..3c24c72 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -990,6 +990,12 @@ release_all_access(struct nfs4_ol_stateid *stp)
>  	}
>  }
>  
> +static inline void nfs4_free_stateowner(struct nfs4_stateowner *sop)
> +{
> +	kfree(sop->so_owner.data);
> +	sop->so_ops->so_free(sop);
> +}
> +
>  static void nfs4_put_stateowner(struct nfs4_stateowner *sop)
>  {
>  	struct nfs4_client *clp = sop->so_client;
> @@ -1000,8 +1006,7 @@ static void nfs4_put_stateowner(struct nfs4_stateowner *sop)
>  		return;
>  	sop->so_ops->so_unhash(sop);
>  	spin_unlock(&clp->cl_lock);
> -	kfree(sop->so_owner.data);
> -	sop->so_ops->so_free(sop);
> +	nfs4_free_stateowner(sop);
>  }
>  
>  static void unhash_ol_stateid(struct nfs4_ol_stateid *stp)
> @@ -3316,7 +3321,8 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfsd4_open *open,
>  		hash_openowner(oo, clp, strhashval);
>  		ret = oo;
>  	} else
> -		nfs4_free_openowner(&oo->oo_owner);
> +		nfs4_free_stateowner(&oo->oo_owner);
> +
>  	spin_unlock(&clp->cl_lock);
>  	return ret;
>  }
> @@ -5216,7 +5222,8 @@ alloc_init_lock_stateowner(unsigned int strhashval, struct nfs4_client *clp,
>  			 &clp->cl_ownerstr_hashtbl[strhashval]);
>  		ret = lo;
>  	} else
> -		nfs4_free_lockowner(&lo->lo_owner);
> +		nfs4_free_stateowner(&lo->lo_owner);
> +
>  	spin_unlock(&clp->cl_lock);
>  	return ret;
>  }
> -- 
> 2.4.3

  reply	other threads:[~2015-07-17 15:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  9:28 [PATCH 00/14] nfsd: some updates and cleanups Kinglong Mee
2015-07-13  9:29 ` [PATCH 01/14] nfsd: Add layouts checking for state resources Kinglong Mee
2015-07-15 15:03   ` J. Bruce Fields
2015-07-16  2:30     ` Kinglong Mee
2015-07-16  2:33       ` [PATCH v2] nfsd: Add layouts checking in client_has_state() Kinglong Mee
2015-07-17 15:54       ` [PATCH 01/14] nfsd: Add layouts checking for state resources J. Bruce Fields
2015-07-13  9:29 ` [PATCH 02/14] nfsd: Add missing gen_confirm in nfsd4_setclientid() Kinglong Mee
2015-07-15 20:47   ` J. Bruce Fields
2015-07-15 20:49     ` J. Bruce Fields
2015-07-16  3:36       ` Kinglong Mee
2015-07-16  3:50         ` Kinglong Mee
2015-07-17 15:58           ` J. Bruce Fields
2015-07-17 17:42             ` Jeff Layton
2015-07-17 23:33               ` [PATCH] nfsd: New counter for generating client confirm verifier Kinglong Mee
2015-07-18 12:16                 ` Jeff Layton
2015-07-20 20:44                   ` J. Bruce Fields
2015-07-23  1:16   ` [PATCH 02/14] nfsd: Add missing gen_confirm in nfsd4_setclientid() Kinglong Mee
2015-07-23 15:53     ` J. Bruce Fields
2015-07-13  9:30 ` [PATCH 03/14] nfsd: Fix memory leak of so_owner.data in nfs4_stateowner Kinglong Mee
2015-07-15 20:57   ` J. Bruce Fields
2015-07-16  4:05     ` [PATCH v2] " Kinglong Mee
2015-07-17 15:59       ` J. Bruce Fields [this message]
2015-07-13  9:30 ` [PATCH 04/14] nfsd: Fix a memory leak of struct file_lock Kinglong Mee
2015-07-15 20:59   ` J. Bruce Fields
2015-07-13  9:31 ` [PATCH 05/14] nfsd: Use check_stateid_generation() for generation checking Kinglong Mee
2015-07-22 18:22   ` J. Bruce Fields
2015-07-23  1:09     ` Kinglong Mee
2015-07-13  9:31 ` [PATCH 06/14] nfsd: Drop duplicate locks_init_lock() Kinglong Mee
2015-07-22 18:24   ` J. Bruce Fields
2015-07-13  9:32 ` [PATCH 07/14] nfsd: Remove unneeded values in nfsd4_open() Kinglong Mee
2015-07-13  9:32 ` [PATCH 08/14] nfsd: Drop duplicate checking of seqid in nfsd4_create_session() Kinglong Mee
2015-07-13  9:32 ` [PATCH 09/14] nfsd: Remove nfs4_set_claim_prev() Kinglong Mee
2015-07-13  9:33 ` [PATCH 10/14] nfsd: Remove unused values in nfs4_setlease() Kinglong Mee
2015-07-13  9:33 ` [PATCH 11/14] nfsd: Remove duplicate checking of nfsd_net in nfs4_laundromat() Kinglong Mee
2015-07-13  9:34 ` [PATCH 12/14] nfsd: Remove macro LOFF_OVERFLOW Kinglong Mee
2015-07-13  9:35 ` [PATCH 13/14] nfsd: Use lk_new_xxx instead of v.new.xxx for nfs4_lockowner Kinglong Mee
2015-07-13  9:35 ` [PATCH 14/14] nfsd: Remove unused clientid arguments from, find_lockowner_str{_locked} Kinglong Mee
2015-07-22 19:22   ` J. Bruce Fields

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=20150717155945.GD6263@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=kinglongmee@gmail.com \
    --cc=linux-nfs@vger.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