linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Jeff Mahoney <jeffm@suse.com>
Cc: Linux FS Maling List <linux-fsdevel@vger.kernel.org>,
	Jan Kara <jack@suse.com>
Subject: Re: [PATCH] quota: add missing use of dq_data_lock in __dquot_initialize
Date: Fri, 1 Mar 2013 10:35:05 +0100	[thread overview]
Message-ID: <20130301093505.GB17177@quack.suse.cz> (raw)
In-Reply-To: <512E61CD.5020501@suse.com>

On Wed 27-02-13 14:43:09, Jeff Mahoney wrote:
> The bulk of __dquot_initialize runs under the dqptr_sem which
> protects the inode->i_dquot pointers. It doesn't protect the
> dereferenced contents, though. Those are protected by the
> dq_data_lock, which is missing around the dquot_resv_space call.
> 
> Cc: Jan Kara <jack@suse.com>
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
  Thanks! I've merged the patch. Just one small nitpick - git(1) expects
diffstat to be separated by three dashes (not two) so I had to fix that up
so that it doesn't appear in the commit message. Not sure how that happened
in your submission but I wanted to point that out just in case it was some
systematic error...

								Honza
> --
> 
>  fs/quota/dquot.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -1439,8 +1439,11 @@ static void __dquot_initialize(struct in
>  			 * did a write before quota was turned on
>  			 */
>  			rsv = inode_get_rsv_space(inode);
> -			if (unlikely(rsv))
> +			if (unlikely(rsv)) {
> +				spin_lock(&dq_data_lock);
>  				dquot_resv_space(inode->i_dquot[cnt], rsv);
> +				spin_unlock(&dq_data_lock);
> +			}
>  		}
>  	}
>  out_err:
> 
> -- 
> Jeff Mahoney
> SUSE Labs
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2013-03-01  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 19:43 [PATCH] quota: add missing use of dq_data_lock in __dquot_initialize Jeff Mahoney
2013-03-01  9:35 ` Jan Kara [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=20130301093505.GB17177@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=jack@suse.com \
    --cc=jeffm@suse.com \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).